From nobody Fri Nov 29 18:33:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=2; a=rsa-sha256; t=1631697251; cv=pass; d=zohomail.com; s=zohoarc; b=UT1VuvIfl41jjkTkXLtnFqXzpCEFfaY8Gtlj+dANCl7TDPOaekZanSZb1Z981JOy5yDK9ypnu0rmq/dZiwkg24zNGFwPOTvhEkoEaYnwQ5+yFybYoexJHeKp5dabZRXdaY2hyAltkdNqFqRy0yWswqfZOjiQM+z3m7w7g8jB9LQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631697251; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TPv3uK8bqSIgwLCsg7oLnpJv0fedDK5iubeaeJBmDWs=; b=oFjcHVwMfNi0Yz2qSCC4GOnl8sWpCIzOtOBtsXb/vOiSHDOtXYSfpXl7pcQpLwDTWKFUp7k7jXwHfCBxxpzzkbjHPGk8mpPShNXbaZTaBHfnKHCYh6Ek3F3UGEkchU+27guOYXnXH6QmokirvUKAEsiTFBjBEn8L9PnC/2oMhPc= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1631697251773641.5966127893396; Wed, 15 Sep 2021 02:14:11 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.187397.336242 (Exim 4.92) (envelope-from ) id 1mQQzM-0001U2-Of; Wed, 15 Sep 2021 09:13:56 +0000 Received: by outflank-mailman (output) from mailman id 187397.336242; Wed, 15 Sep 2021 09:13:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mQQzM-0001Tv-La; Wed, 15 Sep 2021 09:13:56 +0000 Received: by outflank-mailman (input) for mailman id 187397; Wed, 15 Sep 2021 09:13:55 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mQQzL-0001Tf-AZ for xen-devel@lists.xenproject.org; Wed, 15 Sep 2021 09:13:55 +0000 Received: from de-smtp-delivery-102.mimecast.com (unknown [194.104.111.102]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 7117321c-b748-403b-98c6-112c689792df; Wed, 15 Sep 2021 09:13:54 +0000 (UTC) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03lp2057.outbound.protection.outlook.com [104.47.10.57]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-26-bNj072P4M025VJlUB7dzEw-1; Wed, 15 Sep 2021 11:13:52 +0200 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VE1PR04MB7375.eurprd04.prod.outlook.com (2603:10a6:800:1a8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Wed, 15 Sep 2021 09:13:50 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b%7]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 09:13:50 +0000 Received: from [10.156.60.236] (37.24.206.209) by AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Wed, 15 Sep 2021 09:13:50 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 7117321c-b748-403b-98c6-112c689792df DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1631697233; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TPv3uK8bqSIgwLCsg7oLnpJv0fedDK5iubeaeJBmDWs=; b=apgQ/xiIRJ0zyjt+w3QK2sdsw5TXBCosQ/8YFdcvXDK85xuvpsEBCgAyj5pkU+3B4tEWb9 B+/ncF/fpl+t4gPBTAcH9yRYO3SFhlaD+JuUoZ3goeIl85SCfdjazXBiLmW8oGGPc0yPoX Qvr17P+ZHAQiKvG1lgpWcKnGfhYC2kQ= X-MC-Unique: bNj072P4M025VJlUB7dzEw-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bCG3KgvFWoKRGLk0vzMIsx6uAGdCo0wHOGocck3QvFHmCkhNtZ7zCYwaXl2K6J8Jw06UrtvJF0tYoAEmv7vsvy5JgUERf/2+h7hKRbXX7b05fXqSnMV+vopRi6YTADfBbKZ7haX1YMPywPLNOgXOPeJKcrr5qgHmc1ZhCqjZATXQwh2J7GNuaX8+V39w+qVNRynAA0XWePZXpZLB10lX4z79wcwlLjKQmlYoOS/founwdUk39HG4rYqbPLIfaoXV/bPtKRcZrrhas53iFtx3ZWYlKQ6yI1ZdMYdUUxMLWpmZ8FyQbP4o5AyejB0m9uc7dIIAkMJ+h3CyRXHcUlUPOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=TPv3uK8bqSIgwLCsg7oLnpJv0fedDK5iubeaeJBmDWs=; b=O3qt+/t6uVIQEydyIxxfTrz6Cc3rbvFgfDVJTbiFGxL1eKfkgsqy5bX+smjlsq4fUunGKtSoFG5M24yqZOoRPtYknB8ZJ4C6VyHza2tUcq1hVQcrrEsmT21G3ukj2VafqDIpSMVF/G3yOCPBgLDt8MNW+OnSF4QeMTgGLQZmGct8f57kyC/RW5hRdMUgx84TGnE2KNaqOjp+iIOsGGM3h3Clen0MMuHRjGL77+qFInmuScXEfKpiXqPvePA0G8DupMzqK38GASZSDUelItBwOihUZ22lZ1j70xUHrbfQ1gPSpupI7fCG3Gsvycv2DX1k8AZlE6uZ+MZoKEY+PRfdhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com; Subject: [PATCH 4/4] AMD/IOMMU: consider hidden devices when flushing device I/O TLBs From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Paul Durrant , Andrew Cooper References: <6b7fa64a-bd6b-353c-30cb-ec25b850cbed@suse.com> Message-ID: Date: Wed, 15 Sep 2021 11:13:49 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: <6b7fa64a-bd6b-353c-30cb-ec25b850cbed@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 32bb6961-04e3-4b0e-7339-08d9782921a9 X-MS-TrafficTypeDiagnostic: VE1PR04MB7375: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DhtTAYESLKi3B+4UjjZ38SYd9YqjPIDhybF4lJHfWEq3bZmkcvioP22GQYzIZYkBgrolpfYOqtohmh8JYEv7ogwsQXdM0NdBBeijGDRBJnT6xq/pbbqzQIeDkELZf8u08XY0wTt2I1P76AXambUHr4EFuIno3haQrcQcou8hPrk0d/uox38zSt+/29TWCLw9Y4XlCXTgLT/X1w2KCeL/PyfmnySMc0y+O3GOS4+U7luLxudHZi3slhJ1oNDRxaOFhjmxhIGr6tyUAAhzeD9dtUk78gVFgfHVn3tFm/sKkUPLk/pcYtdJI6Bv/P3LvrisJGVgtlLqLcJ5GNoR1GhJ7cK1hsurKNirqkUBdv0w+h9O3bvm0Xs5CF/Ws+dgFSaTBlok/6C0efspCR5IGGET7qAJjvprWM60lVHDHhyIyT9kuUM8codxs6UZh2xBMa9BDE0o+FKsbXbhbmGoGwpgZT/NNLS4M0fu1Ri91Hg9gfXKDUhWXFaAV+/fMDbMMxgT2aYzt5UA/8n0eaeIf4xt36jt812Y9RmMdcERGi/R8mTyFeAs3bACXbYpqNVAegrDOmjVq0HBwEGtDbY4a19pUPe9Eb61pSCPnTYwsnCI/mIQDfOf7ofheFp2nVc6F+7XaGdM92L+uOrspEp/fZn2Lk82GZlNvZfuHJBsCufR5elWr05fLLCtMCLOhoN4DXMNSn0mn20ZnRE276u9uFLNtwgyWrFte3J7r0sHZAdoEJY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(39860400002)(396003)(366004)(136003)(376002)(346002)(38100700002)(2616005)(26005)(54906003)(83380400001)(5660300002)(4326008)(8936002)(316002)(6916009)(31686004)(16576012)(8676002)(66946007)(6486002)(86362001)(31696002)(66476007)(66556008)(2906002)(956004)(186003)(36756003)(478600001)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RUtBRXJzeWhFZUptZGQrQktScHZ1VjYvMlYrdTZyY2FISDBCZHZwRzlqaHNW?= =?utf-8?B?VUhkaTFWNzZBR2Rkc0RzMU93UHE5Y3N1eWJMdDlrZ2NBN1JQRis5T2xpUXhr?= =?utf-8?B?Y29iL3kwRmFlY01Ia1VmZ0NZYi9DMXcwSFRocnFTZldmTUF2Ukw5U3I1K3dL?= =?utf-8?B?ZG9mMW9BN2NCd1Y0WWlRbjM3MzllaDFLaUdLMktuUTVZZEZWaHludHBDSGFI?= =?utf-8?B?eGJ1eW9WMThDRXB5WGFudmZLT1JQNGVrQ3RWKy82Z0Q4RWlhTWRMRVFCbmpQ?= =?utf-8?B?Zitpb0xpaTJVd2g4bTRxbXpkSjI2amlCcTlmaWxsK0l0M3ZhU2J1Q053RFFm?= =?utf-8?B?ckNwbFJPRC9aRTZDbDNYK0RiVzYxdUlacmVpcFV3YzNvcFphaGxzVzBVckFr?= =?utf-8?B?NmtlM1hWTWNHSkx5SFFqaVBCZlRDQW9hZDVCRm1LOCtMOFRaYWk0aFJwY1Bh?= =?utf-8?B?TGZjc0swNGJDeklWZDhyc3NMcm93WGc5YjhtT2tVQ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Q5ZGRTUXFBQkVtckRIUHV4L0FQeXJwdWtReHpW?= =?utf-8?B?cVdwbjhVTTAyZERoWkM3Z0RYeWl5TmRpTHlWVDFRTGJzME93a3FoYVVRU0pz?= =?utf-8?B?S2xIS3hlOHArMjdreG14Z0pjdm84NHY3TDFnclNHOXBOWGE0VnNKNDlpVnR2?= =?utf-8?B?SzNhb2hiWHkwdzFadzNXM2E2VXYvZ2tLV2IwQjhWcks1NmxXZ2N2L21kQjVV?= =?utf-8?B?V2VFbXZmZjJVRnhFN0RTcWt4YmEwOVExSDYrMEZGZkpmU2tFUk52b3hrZDFZ?= =?utf-8?B?SStRdGMwMkJGQ1JWRDkvNmNMN3ZxYXdUSCtsM0Z2U2pSb3dqNjU3VFdicCtK?= =?utf-8?Q?3hEkXufHvtyjlmXApzIrjBSVRM5UYW28VySMySb?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32bb6961-04e3-4b0e-7339-08d9782921a9 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 09:13:50.3950 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: b1SoOOnzcswpQT+qOlCAapvNcGZ6v6sDofaCXqgnEZaa745w7ejKn69l0zmZPF6axcy1bqMS7/9e/4zgVJdaPg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7375 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1631697252706100001 Content-Type: text/plain; charset="utf-8" Hidden devices are associated with DomXEN but usable by the hardware domain. Hence they need flushing as well when all devices are to have flushes invoked. While there drop a redundant ATS-enabled check and constify the first parameter of the involved function. Signed-off-by: Jan Beulich --- a/xen/drivers/passthrough/amd/iommu_cmd.c +++ b/xen/drivers/passthrough/amd/iommu_cmd.c @@ -308,14 +308,11 @@ void amd_iommu_flush_iotlb(u8 devfn, con flush_command_buffer(iommu, iommu_dev_iotlb_timeout); } =20 -static void amd_iommu_flush_all_iotlbs(struct domain *d, daddr_t daddr, +static void amd_iommu_flush_all_iotlbs(const struct domain *d, daddr_t dad= dr, unsigned int order) { struct pci_dev *pdev; =20 - if ( !ats_enabled ) - return; - for_each_pdev( d, pdev ) { u8 devfn =3D pdev->devfn; @@ -343,7 +340,16 @@ static void _amd_iommu_flush_pages(struc } =20 if ( ats_enabled ) + { amd_iommu_flush_all_iotlbs(d, daddr, order); + + /* + * Hidden devices are associated with DomXEN but usable by the + * hardware domain. Hence they need dealing with here as well. + */ + if ( is_hardware_domain(d) ) + amd_iommu_flush_all_iotlbs(dom_xen, daddr, order); + } } =20 void amd_iommu_flush_all_pages(struct domain *d)