[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:58:58 +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=4MIjHanZ1EMNdqSB3f9LlOxOrXhSMx0XnBMb/HcIf2k=; b=a6bxc2CP+iTm4c8A3nVRKIrBzRjx5CHVjB/xDv8bgwQXZnK5jl3cEjAiJkW0gb/gkNGyrLLuecevOxZ/ulkT1Nym62iW9iulEcnXxIPYMPqFa0XkYeWLWXkzE8lKxIsCB1Uvoau5djpabhtU9SPSFWVrfiLH95SVUh99fREW1yrzCML5UWzbMiy8nDnQgkgbCqUTyxQrqyH4GFFXMw24Fsw7SrDf3i5eYsTuKGKEIQa/jngu4006GmIsSLBapy0lxtQsZBIz/NKjyfGVcbZWkoAiuK02Uc+3w9uIPZu7gSZAxrDOpdHpE3PcRTzXKccn7Dfiz8uCkBdxVKk+iB0QSw==
  • 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=4MIjHanZ1EMNdqSB3f9LlOxOrXhSMx0XnBMb/HcIf2k=; b=aI26OliaVUOTAzstwHANandaaFzqjO1cpawhMCHLuRYxG7Ho8vhElqZLxY3cjyOwzpJnLREADWEiMR+ntDSWFr3W3nw53nE3qMlIfZUeuXcZHbNcGHH+Iwmm1dpkeqW2KOUWHgNBw7DrwR2ScKkZ/I3ndaNhEf0Zd7ct14HwOfQVpwVqyROrHnTAdhTdhwWK4OQBvuhaLFzZhKUlt6pnbLwM6nzFaBzVyagXbbjI5Aq6oT/obXgzL2Sj4jsuE/OHBmO+OJbbkrWIGzpDZulLrVdlMOlBNUOnWYsPKQytGq2a/zZABfSsWiJ0lb0OTnK0KCB+GwZyPdO0A5ogwixYig==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=D/bvtRWAuYAWigAuK685X84DgLvsBraRRe8ezWLALV44fKLhhDCjbWrlXA+VIx7kAmHnkUKL1ZJeAswOvBaXx89QF7Ih8XkhROlDwdvKp8o6lkg0/kz1YFbLrP393Ez8vg3Z29OYsah4o8RdgB11rAm9XdwJYqS/5ZblbWQr5j3IVboC147fK5GBL3A/q3h3LsThiAn8M8lS/A1v1siZDkGjKF07t4sOsC/L5P8lCbACmd9ymTJ7yIW6u32msaNfIWZdWV/yRdSMBV2KiyUpntK1rDiqbygsnONPK6cOVKoALXthNm+NIDEgb+SrDCP5m8LRF2Ytk0qoF5dD19oigQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=POX5qpwdc35DaDfKcJZkbAd+sEd0AB4Ha2KwRac96FGkOaJPg8hMBHP2KuOz+tI4mGXkGkT1itmg1Ddlve8EslVpNdGEURTXzqIzH+3RdZaHlohwJeZZk5Fl/Rqng9acKtWo0Ofu8OQ+cSjSHLQX3pMSqTHIi7eQjGr5cCiuIuefITJTrY+4He/rt22dxbtAdgth2BhjkWAnTUUPY0s7d2rNIZJ24FZ9Yn4kpxwf36dwdqpZoSpMqf1uQXWAQpIhZF7e3A6/DXB5Pzsei0vooRvBaNnkBMeMgNZGFVMp4gPyr8t6bBk7WbXT1KwRmE4ApAmy8Sz5mttTuA5xwzOj1Q==
  • 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:59:25 +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: AQHbfS852PGMwQJcDk23CJnJhhVOo7NDjlKAgAAM3QCAAAYPgA==
  • Thread-topic: [PATCH 1/2] xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH


> On 12 Feb 2025, at 12:37, Luca Fancellu <Luca.Fancellu@xxxxxxx> wrote:
> 
> 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?

Oh sorry, nevermind this point, I see I can maybe use the same approach as 
need_iommu_pt_sync(d)

> 
> Cheers,
> Luca



 


Rackspace

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