From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA4501E2848 for ; Fri, 3 Jan 2025 09:32:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735896750; cv=none; b=CJAMdIwmBfYbOgEjoOv6VSgbnqoXuW3LftHYoCIThObpi4i+JW9XL/rCkXXPjbuBEZ8XdgFYiQEQHPO09IRF5lBdO13T1qjXEntDRdCY54p4SW+1FVeZXt56+5ItYMAIgWGV5snTmZNQBCospQdDMVesmWFsKOsRVbSTq0soS9Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735896750; c=relaxed/simple; bh=8hwVLb257DB6lTDwcxOmIEnyHP2yCeOfTnNvE7q+Nx0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=nuXAfhNvx6mnpuIg8tgZl5WyLiexxOSUaPL3HRPNqdUgtE9JG9b5ZGpu56vpzUi0hPBvcFTMXZpNPSbtz40BsqDQKvHxgYHmaWY5V8Iidz5TedQOrOdocciIzrQ/EkOblN8CKJP1zSJCfWngptdpD8xsT/aJfFgwzSKgXHAezs0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=fr0rW8MO; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="fr0rW8MO" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-219f8263ae0so123585305ad.0 for ; Fri, 03 Jan 2025 01:32:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1735896748; x=1736501548; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=SKk1FI6zQyxC6Jfeaa2W406Eo5j/J0Vbugy5i2jnps4=; b=fr0rW8MOdKBs0QIeC8MMrPFest6e3sds1TVqg+fj49cW+QZ1z+B0kZ180UwvE3d6sg FTQ5iB3ElfVeT2D1ZBRm2nv6jr8K7kKp4vX8mwSsSw0illLGbYP4yayiiLaRMU84Fs1y RUUwLnjojh0qyqR8OwSykopswil4A0PvGHh4qCjNYEMTxyJu98TJ8N0G4pUtMkVGB5w3 /pp9mfea/jORqpIqyx2HMpt687N0imWaT8DzqbvvXri42xqqFv8egEPGceiYTXDm8zHu jYXKPXKjDrN3nEhTzrJhz67oOgsrVg3tbJ7RdQY8ogCe0fjIHfneCltUF2rEFKBi1jxj uJSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735896748; x=1736501548; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SKk1FI6zQyxC6Jfeaa2W406Eo5j/J0Vbugy5i2jnps4=; b=QCFhvTE2wd8SP5tIxv8RmPuc7+cnC77mLLT7/NqBOXtugr5LwCdnAELZ5HhbiZzeXN hpBrdOoFVGYNGfro6t1fo1KnvIuIKLVXoA53ol20RltbBE8g6wmF0mzBM80jOuThC2Ip +kPd37T8RSmkF8qt1JaqfjMB1fcOpmnuS38OkDvZx/1A6pUiLuXE5vRwX6MDvKFeFNec SSFLr5aY/98z6aMsHbbz905J0BcJPWTInHe3eKGMU8O/sX3fq+QxIjf0HtKwJJMf+grZ czC/LU1xBOKe8fBBTgjBqGE89srGEy+OEqt17nLLEV86Z+5Es/GjgyL7pEZHZg1rdK8q X2KA== X-Forwarded-Encrypted: i=1; AJvYcCXtULX3huXr+YmMGIs4qQuzZO4+uPj2hIDUEkFo0y0kpQYWKoN/lQ/q1kSBJx8cNCvlchIUncKf+sA6/Bg=@vger.kernel.org X-Gm-Message-State: AOJu0YzGQ2kzFs4yW2PaScHGF2MDnBhxBSxN+AN7ACuqwsjy13HOlnz2 /MV7E3bELD0InUoJzJSMTCSXQzoTVAuV0WIwJe/htEejZVOkHeimKKzttq3aq7k= X-Gm-Gg: ASbGnctzyzfXnO+i1oHZYM1jCwLk+gSrlK/cyV9nY2YNuP0rGfq1wma6mi89WlUPv2+ 6oVrpSCbTc1J72f9W8b5xlCrtzbpzA161bQ4ZrtaXhkYy6s50iy3XK2St8qTUw0bsXHvawYC6U0 AAogd+ulcwZm19YcTp14P8fsiGimXCk0uOVtTUobNb8g/xyYKdaaWY4QzOwMIgNkSJpe1UaIgtG 8O87ck9SmQUHlEePS6KRj+OJTMbSftYH0LUtEo1kJ/ECobqsQ9kuTcAwpkAsLjddwmD9RICw6ae 3/PwvcG2dHo43hk8r5vP7J67JtFarj3gQPCfcbw= X-Google-Smtp-Source: AGHT+IGBzxD4H34Ifr5hg3tZ1klbrrjY+CrreB/5URknlVxUQwbmgmz/BsJ+ZoGNL1+L0MbwMbpjzQ== X-Received: by 2002:a17:903:238b:b0:216:39fa:5cb4 with SMTP id d9443c01a7336-219e6eb6234mr722356135ad.25.1735896748046; Fri, 03 Jan 2025 01:32:28 -0800 (PST) Received: from J9GPGXL7NT.bytedance.net ([61.213.176.55]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9f4a2csm242227395ad.175.2025.01.03.01.32.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Jan 2025 01:32:27 -0800 (PST) From: Xu Lu To: tjeznach@rivosinc.com, joro@8bytes.org, will@kernel.org Cc: lihangjing@bytedance.com, xieyongji@bytedance.com, guojinhui.liam@bytedance.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Xu Lu Subject: [PATCH RESEND 0/2] riscv: iommu: Add shutdown callback for kexec Date: Fri, 3 Jan 2025 17:32:18 +0800 Message-Id: <20250103093220.38106-1-luxu.kernel@bytedance.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit After kexec, the newly booted kernel can not initialize iommu driver successfully as no one resets iommu state before kexec. This patch series supplies shutdown callback for iommu driver. The shutdown callback resets necessary registers so that newly booted kernel can pass riscv_iommu_init_check() after kexec. Xu Lu (2): iommu/riscv: Empty iommu queue before enabling it iommu/riscv: Add shutdown function for iommu driver drivers/iommu/riscv/iommu-pci.c | 8 ++++++++ drivers/iommu/riscv/iommu-platform.c | 6 ++++++ drivers/iommu/riscv/iommu.c | 12 ++++++++++-- drivers/iommu/riscv/iommu.h | 1 + 4 files changed, 25 insertions(+), 2 deletions(-) -- 2.20.1