[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Wed, 12 Feb 2025 12:37:16 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2/0KKGv2BAtQLDfbhlAEoRo0FpWKuZrZiCwuvKWFzXs=; b=lI9zigXybsrflXIZbOf5isr8ngAnvCT27GcJQHk55/S+jQo2lrVZHaHLhBq7n5D5Wv00gUIAL7GUuzPPtvQIIzUwMZcaZHY9mOzJ6ijmeLPFmLAsh6lnnCjCLIcvKdz4d/TwM6bKHULSCHGfV25OFL1rXqEqGn2gGwJG8wWUjMxf6/7kwlY36nht1d5d9jueeN0HRhUwULCR8uA94hgx9h78nfIiTIAqgWpA+iHtPHCfvfmDntdMC720tlFmr3OjG2V+hBDllF7E3dxe1JnRC9/M5VxIku2NCKNuvl8rxnBAz6G+6UXp/YvzYIxibp3A9YZIN1HL+OfvSt7u98Sbmg==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2/0KKGv2BAtQLDfbhlAEoRo0FpWKuZrZiCwuvKWFzXs=; b=owc0dWhfdptXTr9OIrWRNtK6sKM50nKKJj5d/Viiel3mpoQYTPTcgur1r+mVhdb//aSjAv7XVLhDpXOM4iwG/5+3mHUdDi8vrKOhHmk3TEv7xaJ959PxkD+e1l9qisAQndnROF5Wk638yriyf9nQZNLVg/5+PjqfKEdptcxSfHyfa9Gz9GBRRvM8d3xj512RYAZr/+ToRrHY1t2ssu8fJogwB3YFPuN2fZOHwsqt8fZoou6eTWTkrZKl53IX4rSSOOjZ+e969q5B84gb+ngIyZd8nc2kjJx8sLtIhgemp5y+kLY9DZzDQ3z+AWMk/F/SKOb4tYMejQvmBzPd5r4zmg==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=YdldqVPAkBLAilQTLq9AXAi9fuiHbc7Lgj48vP/KCvKDvygFsa5W3jU/eIkACcwOo3Jgje9eqjg2EO6QtKFTBXPux5D3LEs2nKq8KXiDOmaw3IhfPTHi8mnzGd6bghQcdcjhxl04z90BXc4k+Fq2NCBNVphTjXtXPUjfm32ytRr5lRwi4BQWk+O67ec4VDPYTrtjbMoe9PHccMyRfnBBpGtQ3OkhINotVDb4EchU0QDDMaOfBV6Bw8bWX+6McjrtiMMhVshWivmKvZ3krOtGo12siIU/xzoQmclHpJAsBe+R5lVl5+EhCN5w+1Mom+0encIKfWp+RcUc/7eQAZb2fw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cx0B/kdzIrE2W6oZOt5lFGm9byPCRpR5xP6PmTd5k6ffBOhhH1dr0Iy2hUcQaaBhCD2qfSwV9JvwPZD+8fFMML7kF3i3649U2Pnf0mfIGJUyVCb/jekYZySogVv9QHP739v1rxeatGZHbXFHoxmlWlFsc7OwpHkqdPPG8CyXhJ43IU/133tcLkjdvS9eUklWIy55JZMOKjEK9w8Zcb2DCevGhxI50LegGwHEPXVy0Mdw/EKBthuc/KOlRNcN1LcjUNj9QnDbwuLGOVbcvsSfFZ70aN3un6kP7k0tbG7R5nwQqm4VSCE1GuxUWQCTgsMhseqLuuCrvqVtCmUji0R+ng==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 12 Feb 2025 12:37:57 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHbfS852PGMwQJcDk23CJnJhhVOo7NDjlKAgAAM3QA=
  • Thread-topic: [PATCH 1/2] xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH

Hi Andrew,

thanks for your review,

> On 12 Feb 2025, at 11:50, Andrew Cooper <andrew.cooper3@xxxxxxxxxx> wrote:
> 
> On 12/02/2025 9:18 am, Luca Fancellu wrote:
>> When Xen is built without HAS_PASSTHROUGH, there are some parts
>> in arm and x86 where iommu_* functions are called in the codebase,
>> but their implementation is under xen/drivers/passthrough that is
>> not built.
>> 
>> So provide some stub for these functions in order to build Xen
>> when !HAS_PASSTHROUGH, which is the case for example on systems
>> with MPU support.
>> 
>> Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
>> ---
>> xen/arch/arm/include/asm/grant_table.h |  8 ++++++
>> xen/include/xen/iommu.h                | 40 +++++++++++++++++++++++---
>> 2 files changed, 44 insertions(+), 4 deletions(-)
>> 
>> diff --git a/xen/arch/arm/include/asm/grant_table.h 
>> b/xen/arch/arm/include/asm/grant_table.h
>> index d3c518a926b9..e21634b752df 100644
>> --- a/xen/arch/arm/include/asm/grant_table.h
>> +++ b/xen/arch/arm/include/asm/grant_table.h
>> @@ -73,9 +73,17 @@ int replace_grant_host_mapping(uint64_t gpaddr, mfn_t 
>> frame,
>> #define gnttab_status_gfn(d, t, i)                                       \
>>     page_get_xenheap_gfn(gnttab_status_page(t, i))
>> 
>> +#ifdef CONFIG_HAS_PASSTHROUGH
>> +
>> #define gnttab_need_iommu_mapping(d)                    \
>>     (is_domain_direct_mapped(d) && is_iommu_enabled(d))
>> 
>> +#else
>> +
>> +#define gnttab_need_iommu_mapping(d) (false)
> 
> This doesn't evaluate d, which can lead to other build problems.
> 
> Instead of providing two, you should insert
> "IS_ENABLED(CONFIG_HAS_PASSTHROUGH) &&" into the existing
> gnttab_need_iommu_mapping().

I’ll do that for this case, I already checked and it works well, just for my 
knowledge could you
explain to me what build problems can happen? Is it something related to the 
compiler that
doesn’t see a usage for d?


> 
> The same applies to several other hunks too.

Are you referring to iommu_use_hap_pt? I have to say that I’ve tried before to 
insert another
IS_ENABLED(…) but it was failing the compilation because without HAS_PASSTHROUGH
dom_iommu(d) is (&(d)->iommu), but the iommu field doesn’t exists.

So I’m not sure how to proceed there, do you have any suggestions?

Cheers,
Luca

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.