[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6baeb3c4-a493-80d1-439d-fa7dbe1a703a@gmail.com>
Date: Fri, 10 Dec 2021 22:01:16 +0800
From: Tianyu Lan <ltykernel@...il.com>
To: "Michael Kelley (LINUX)" <mikelley@...rosoft.com>,
KY Srinivasan <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
"wei.liu@...nel.org" <wei.liu@...nel.org>,
Dexuan Cui <decui@...rosoft.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"bp@...en8.de" <bp@...en8.de>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"x86@...nel.org" <x86@...nel.org>, "hpa@...or.com" <hpa@...or.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"kuba@...nel.org" <kuba@...nel.org>,
"jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
"arnd@...db.de" <arnd@...db.de>,
"hch@...radead.org" <hch@...radead.org>,
"m.szyprowski@...sung.com" <m.szyprowski@...sung.com>,
"robin.murphy@....com" <robin.murphy@....com>,
Tianyu Lan <Tianyu.Lan@...rosoft.com>,
"thomas.lendacky@....com" <thomas.lendacky@....com>
Cc: "iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
vkuznets <vkuznets@...hat.com>,
"brijesh.singh@....com" <brijesh.singh@....com>,
"konrad.wilk@...cle.com" <konrad.wilk@...cle.com>,
"hch@....de" <hch@....de>, "joro@...tes.org" <joro@...tes.org>,
"parri.andrea@...il.com" <parri.andrea@...il.com>,
"dave.hansen@...el.com" <dave.hansen@...el.com>
Subject: Re: [PATCH V6 3/5] hyper-v: Enable swiotlb bounce buffer for
Isolation VM
On 12/10/2021 9:25 PM, Tianyu Lan wrote:
>>> @@ -319,8 +320,16 @@ static void __init ms_hyperv_init_platform(void)
>>> pr_info("Hyper-V: Isolation Config: Group A 0x%x, Group B
>>> 0x%x\n",
>>> ms_hyperv.isolation_config_a,
>>> ms_hyperv.isolation_config_b);
>>>
>>> - if (hv_get_isolation_type() == HV_ISOLATION_TYPE_SNP)
>>> + if (hv_get_isolation_type() == HV_ISOLATION_TYPE_SNP) {
>>> static_branch_enable(&isolation_type_snp);
>>> + swiotlb_unencrypted_base = ms_hyperv.shared_gpa_boundary;
>>> + }
>>> +
>>> + /*
>>> + * Enable swiotlb force mode in Isolation VM to
>>> + * use swiotlb bounce buffer for dma transaction.
>>> + */
>>> + swiotlb_force = SWIOTLB_FORCE;
>> I'm good with this approach that directly updates the swiotlb settings
>> here
>>
>> rather than in IOMMU initialization code. It's a lot more
>> straightforward.
>>
>> However, there's an issue if building for X86_32 without PAE, in that the
>> swiotlb module may not be built, resulting in compile and link
>> errors. The
>> swiotlb.h file needs to be updated to provide a stub function for
>> swiotlb_update_mem_attributes(). swiotlb_unencrypted_base probably
>> needs wrapper functions to get/set it, which can be stubs when
>> CONFIG_SWIOTLB is not set. swiotlb_force is a bit of a mess in that
>> it already
>> has a stub definition that assumes it will only be read, and not set.
>> A bit of
>> thinking will be needed to sort that out.
>
> It's ok to fix the issue via selecting swiotlb when CONFIG_HYPERV is
> set?
>
Sorry. ignore the previous statement. These codes doesn't depend on
CONFIG_HYPERV.
How about making these code under #ifdef CONFIG_X86_64 or CONFIG_SWIOTLB?
Powered by blists - more mailing lists