iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu/amd: remove amd_iommu_snp_enable
@ 2023-08-31 12:31 Christoph Hellwig
  2023-08-31 18:03 ` Kim Phillips
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2023-08-31 12:31 UTC (permalink / raw)
  To: joro; +Cc: suravee.suthikulpanit, iommu

amd_iommu_snp_enable is unused and has been since it was added in commit
fb2accadaa94 ("iommu/amd: Introduce function to check and enable SNP").

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/iommu/amd/init.c  | 38 --------------------------------------
 include/linux/amd-iommu.h |  4 ----
 2 files changed, 42 deletions(-)

diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index ea0f1ab9417837..9f22e469da973b 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -3744,41 +3744,3 @@ int amd_iommu_pc_set_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, u8 fxn, u64
 
 	return iommu_pc_get_set_reg(iommu, bank, cntr, fxn, value, true);
 }
-
-#ifdef CONFIG_AMD_MEM_ENCRYPT
-int amd_iommu_snp_enable(void)
-{
-	/*
-	 * The SNP support requires that IOMMU must be enabled, and is
-	 * not configured in the passthrough mode.
-	 */
-	if (no_iommu || iommu_default_passthrough()) {
-		pr_err("SNP: IOMMU is disabled or configured in passthrough mode, SNP cannot be supported");
-		return -EINVAL;
-	}
-
-	/*
-	 * Prevent enabling SNP after IOMMU_ENABLED state because this process
-	 * affect how IOMMU driver sets up data structures and configures
-	 * IOMMU hardware.
-	 */
-	if (init_state > IOMMU_ENABLED) {
-		pr_err("SNP: Too late to enable SNP for IOMMU.\n");
-		return -EINVAL;
-	}
-
-	amd_iommu_snp_en = check_feature_on_all_iommus(FEATURE_SNP);
-	if (!amd_iommu_snp_en)
-		return -EINVAL;
-
-	pr_info("SNP enabled\n");
-
-	/* Enforce IOMMU v1 pagetable when SNP is enabled. */
-	if (amd_iommu_pgtable != AMD_IOMMU_V1) {
-		pr_warn("Force to using AMD IOMMU v1 page table due to SNP\n");
-		amd_iommu_pgtable = AMD_IOMMU_V1;
-	}
-
-	return 0;
-}
-#endif
diff --git a/include/linux/amd-iommu.h b/include/linux/amd-iommu.h
index 953e6f12fa1c30..58e6c3806c09d4 100644
--- a/include/linux/amd-iommu.h
+++ b/include/linux/amd-iommu.h
@@ -206,8 +206,4 @@ int amd_iommu_pc_get_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, u8 fxn,
 		u64 *value);
 struct amd_iommu *get_amd_iommu(unsigned int idx);
 
-#ifdef CONFIG_AMD_MEM_ENCRYPT
-int amd_iommu_snp_enable(void);
-#endif
-
 #endif /* _ASM_X86_AMD_IOMMU_H */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] iommu/amd: remove amd_iommu_snp_enable
  2023-08-31 12:31 [PATCH] iommu/amd: remove amd_iommu_snp_enable Christoph Hellwig
@ 2023-08-31 18:03 ` Kim Phillips
  2023-09-01  5:50   ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Kim Phillips @ 2023-08-31 18:03 UTC (permalink / raw)
  To: Christoph Hellwig, joro
  Cc: suravee.suthikulpanit, iommu, Michael Roth, Kalra, Ashish, kvm,
	linux-coco

+Mike Roth, Ashish

On 8/31/23 7:31 AM, Christoph Hellwig wrote:
> amd_iommu_snp_enable is unused and has been since it was added in commit
> fb2accadaa94 ("iommu/amd: Introduce function to check and enable SNP").
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

It is used by the forthcoming host SNP support:

https://lore.kernel.org/lkml/20230612042559.375660-8-michael.roth@amd.com/

Thanks,

Kim

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] iommu/amd: remove amd_iommu_snp_enable
  2023-08-31 18:03 ` Kim Phillips
@ 2023-09-01  5:50   ` Christoph Hellwig
  2023-09-06 13:36     ` Jason Gunthorpe
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2023-09-01  5:50 UTC (permalink / raw)
  To: Kim Phillips
  Cc: Christoph Hellwig, joro, suravee.suthikulpanit, iommu,
	Michael Roth, Kalra, Ashish, kvm, linux-coco

On Thu, Aug 31, 2023 at 01:03:53PM -0500, Kim Phillips wrote:
> +Mike Roth, Ashish
>
> On 8/31/23 7:31 AM, Christoph Hellwig wrote:
>> amd_iommu_snp_enable is unused and has been since it was added in commit
>> fb2accadaa94 ("iommu/amd: Introduce function to check and enable SNP").
>>
>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>> ---
>
> It is used by the forthcoming host SNP support:
>
> https://lore.kernel.org/lkml/20230612042559.375660-8-michael.roth@amd.com/

Then resend it with that support, but don't waste resources and everyones
time now.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] iommu/amd: remove amd_iommu_snp_enable
  2023-09-01  5:50   ` Christoph Hellwig
@ 2023-09-06 13:36     ` Jason Gunthorpe
  2023-09-07  9:55       ` Suthikulpanit, Suravee
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Gunthorpe @ 2023-09-06 13:36 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Kim Phillips, joro, suravee.suthikulpanit, iommu, Michael Roth,
	Kalra, Ashish, kvm, linux-coco

On Fri, Sep 01, 2023 at 07:50:20AM +0200, Christoph Hellwig wrote:
> On Thu, Aug 31, 2023 at 01:03:53PM -0500, Kim Phillips wrote:
> > +Mike Roth, Ashish
> >
> > On 8/31/23 7:31 AM, Christoph Hellwig wrote:
> >> amd_iommu_snp_enable is unused and has been since it was added in commit
> >> fb2accadaa94 ("iommu/amd: Introduce function to check and enable SNP").
> >>
> >> Signed-off-by: Christoph Hellwig <hch@lst.de>
> >> ---
> >
> > It is used by the forthcoming host SNP support:
> >
> > https://lore.kernel.org/lkml/20230612042559.375660-8-michael.roth@amd.com/
> 
> Then resend it with that support, but don't waste resources and everyones
> time now.

+1

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

I've said this many times lately. There are other things in this
driver that have no upstream justification too, like nesting
"support".

Please organize this SNP support into series that makes sense and are
self complete :( I'm not sure a 51 patch series is a productive way to
approach this..

Jason

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] iommu/amd: remove amd_iommu_snp_enable
  2023-09-06 13:36     ` Jason Gunthorpe
@ 2023-09-07  9:55       ` Suthikulpanit, Suravee
  2023-09-07 16:10         ` Jason Gunthorpe
  0 siblings, 1 reply; 6+ messages in thread
From: Suthikulpanit, Suravee @ 2023-09-07  9:55 UTC (permalink / raw)
  To: Jason Gunthorpe, Christoph Hellwig
  Cc: Kim Phillips, joro, iommu, Michael Roth, Kalra, Ashish, kvm, linux-coco



On 9/6/2023 8:36 PM, Jason Gunthorpe wrote:
> On Fri, Sep 01, 2023 at 07:50:20AM +0200, Christoph Hellwig wrote:
>> On Thu, Aug 31, 2023 at 01:03:53PM -0500, Kim Phillips wrote:
>>> +Mike Roth, Ashish
>>>
>>> On 8/31/23 7:31 AM, Christoph Hellwig wrote:
>>>> amd_iommu_snp_enable is unused and has been since it was added in commit
>>>> fb2accadaa94 ("iommu/amd: Introduce function to check and enable SNP").
>>>>
>>>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>>>> ---
>>>
>>> It is used by the forthcoming host SNP support:
>>>
>>> https://lore.kernel.org/lkml/20230612042559.375660-8-michael.roth@amd.com/
>>
>> Then resend it with that support, but don't waste resources and everyones
>> time now.
> 
> +1
> 
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Duly noted :)

The reason we introduced this change separately from the SNP series was 
because it is part of a different subsystem, which normally get pulled 
in separately. Unfortunately the main series takes a long time to get 
into upstream Linux kernel. So, this code appears as unused, which I can 
see how it can be confusing to other developers.

FYI: This is just removing a function to enable SNP support in AMD IOMMU 
driver. The underlying logic to enable the hardware still exist, which 
is part of the SNP feature enablement of the AMD IOMMU driver.

Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>

> I've said this many times lately. There are other things in this
> driver that have no upstream justification too, like nesting
> "support".

Jason, there is no need to keep repeating and polluting this thread. I 
am happy to discuss and clarify any points of your concern on the 
"nesting support" in a separate discussion thread :)

> Please organize this SNP support into series that makes sense and are
> self complete :( I'm not sure a 51 patch series is a productive way to
> approach this..

We have discussed with Michael Roth (the author of the series "Add AMD 
Secure Nested Paging (SEV-SNP) Hypervisor Support"​), and he will start 
including the removed function in the next revision of his series.

Regards,
Suravee

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] iommu/amd: remove amd_iommu_snp_enable
  2023-09-07  9:55       ` Suthikulpanit, Suravee
@ 2023-09-07 16:10         ` Jason Gunthorpe
  0 siblings, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2023-09-07 16:10 UTC (permalink / raw)
  To: Suthikulpanit, Suravee
  Cc: Christoph Hellwig, Kim Phillips, joro, iommu, Michael Roth,
	Kalra, Ashish, kvm, linux-coco

On Thu, Sep 07, 2023 at 04:55:52PM +0700, Suthikulpanit, Suravee wrote:

> > I've said this many times lately. There are other things in this
> > driver that have no upstream justification too, like nesting
> > "support".
> 
> Jason, there is no need to keep repeating and polluting this thread. I am
> happy to discuss and clarify any points of your concern on the "nesting
> support" in a separate discussion thread :)

It is not polluting this thread. We are, again, asking AMD to follow
the rules please.

None of the other threads about the nesting has resulted in acceptance
that code needs to be removed as well. Go respond in one of those if
you have something to add.

Jason

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-09-07 16:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-31 12:31 [PATCH] iommu/amd: remove amd_iommu_snp_enable Christoph Hellwig
2023-08-31 18:03 ` Kim Phillips
2023-09-01  5:50   ` Christoph Hellwig
2023-09-06 13:36     ` Jason Gunthorpe
2023-09-07  9:55       ` Suthikulpanit, Suravee
2023-09-07 16:10         ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).