From patchwork Tue May 9 11:03:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 13235619 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 53145C7EE24 for ; Tue, 9 May 2023 11:04:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.532109.828131 (Exim 4.92) (envelope-from ) id 1pwL8q-0003ME-FT; Tue, 09 May 2023 11:04:24 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 532109.828131; Tue, 09 May 2023 11:04:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pwL8q-0003M7-Bj; Tue, 09 May 2023 11:04:24 +0000 Received: by outflank-mailman (input) for mailman id 532109; Tue, 09 May 2023 11:04:23 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pwL8p-0003Lz-AK for xen-devel@lists.xenproject.org; Tue, 09 May 2023 11:04:23 +0000 Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 3f820814-ee59-11ed-b227-6b7b168915f2; Tue, 09 May 2023 13:04:21 +0200 (CEST) Received: from mail-bn8nam12lp2171.outbound.protection.outlook.com (HELO NAM12-BN8-obe.outbound.protection.outlook.com) ([104.47.55.171]) by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 May 2023 07:04:19 -0400 Received: from SJ0PR03MB6423.namprd03.prod.outlook.com (2603:10b6:a03:38d::21) by CH2PR03MB5368.namprd03.prod.outlook.com (2603:10b6:610:9d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.33; Tue, 9 May 2023 11:04:16 +0000 Received: from SJ0PR03MB6423.namprd03.prod.outlook.com ([fe80::b0b8:8f54:2603:54ec]) by SJ0PR03MB6423.namprd03.prod.outlook.com ([fe80::b0b8:8f54:2603:54ec%4]) with mapi id 15.20.6363.032; Tue, 9 May 2023 11:04:16 +0000 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: 3f820814-ee59-11ed-b227-6b7b168915f2 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1683630261; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=CdHTu5cLFhVVdekV7oETNew1x2H7T1z1YCZ4sBCK6tE=; b=Xoy+2JyAyyXwU91PkdX8tBc/UVG0DnIw2Jey2zKT6yFbcGfIcmQznLmB ntQdvS+Xz0djJhsbdevvLIBaaNrMW/MWphgcy1Lvy9z6YrzdFMljsORMg wUPnh39HFWDdGJU321fI8af5F8rBBw72k3DGTh4cbZcALJoY4u7NPLGZ+ c=; X-IronPort-RemoteIP: 104.47.55.171 X-IronPort-MID: 108776587 X-IronPort-Reputation: None X-IronPort-Listener: OutboundMail X-IronPort-SenderGroup: RELAY_O365 X-IronPort-MailFlowPolicy: $RELAYED IronPort-Data: A9a23:utWWbK0v67ioTzkJufbD5fNwkn2cJEfYwER7XKvMYLTBsI5bp2BRn GIcCm7VbvjYYjOmftAjaYS08BsBvZ6AnNVjSFE/pC1hF35El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/93/563EXlSg9YXtOaZahxJbmI= X-IronPort-AV: E=Sophos;i="5.99,261,1677560400"; d="scan'208";a="108776587" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K6399ZA2Lw2MTkbtY75Ek8PEkSQjCkgWKIo3OUkvDWAyZBiJywN+wRXidEdeY3EHarQBNLZkrPQrNvbXHxRWe366iLyTIXvmpyzu8N5KUJYQv8W7/75vkLbsDOZkb/KR966ocs+M+rbjTKY7C9+ez1M4q6Ql07+t8ZnEvYfmrU36/uGITR+f2rgrvqALOCli+K8x638eRjyr9u9LhbcT+DEEk3uNrPc18TNqX1Qlx/63vkOXb02QCs6KgvFCYnUdDgXhQUE/vr1kOuq56TFfCjmfgOKaCMsbaTc4rPrm+4fTVB2Uks48uCxGRzPdYKkRsRvLZQ6mGZajuZ7LKpoCKg== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EEVdwpNoDpCMI+qjQBMvK79jWyy35hxraOfYHbD9/PY=; b=O9+8EH3RpAZ0E5HHTlmp1MC3Du80FxScR3EmY7iA1PjdVCCkQEmIjue6xOxQOpky5gzffzr0IBop4lC2Mob5jCvAvf+k9FUQSoaoqy7e883YZVJhpmsCS2no7vnsfzh3pL/9FGz5RhtkLQ5iySZDKm8V9dtKSKb+ZU1hkD5PaWAUQBm8CQtq04By0JwHyfLwd41tY+tShKNNCWf3kQrgSK76Q+h2XK/iogWX8DEsiFDhZUjamO8YYJOQGFs+XUYEWdKgIjRySKyQaq79CQ+TXePmZ7PA1Ev5a5P4JGSwPe6AU058SRjG8CTDxLg0djdxAZRfOP9X2R0s6O1B3eKbCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EEVdwpNoDpCMI+qjQBMvK79jWyy35hxraOfYHbD9/PY=; b=SQ8SaFduFzXJCyNRdcxffYddyCSBTyffjZyXhaSvRU3RavUUCvyl668UwjGbrZW7gT28vqoxVcvtHSlf8WzYWLws85lybgb9u9+UtvETS6fbKcNHXCxANoCbRHRxI3UMiwTZK3+QvuTluaBFzNIfUXMYfCpEbfguFk5NZOgPALQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com; From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Paul Durrant Subject: [PATCH] x86/iommu: fix wrong iterator type in arch_iommu_hwdom_init() Date: Tue, 9 May 2023 13:03:25 +0200 Message-Id: <20230509110325.61750-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.40.0 X-ClientProxiedBy: LO4P123CA0111.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:192::8) To SJ0PR03MB6423.namprd03.prod.outlook.com (2603:10b6:a03:38d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR03MB6423:EE_|CH2PR03MB5368:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c1b70f1-3cd6-465e-e30f-08db507d2145 X-LD-Processed: 335836de-42ef-43a2-b145-348c2ee9ca5b,ExtAddr,ExtFwd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gKSe0yby7K78C4izqXNDGU/VcGrIIG3htr74Wu7OVdPd4A4mweBnY2n4PUgda8rBEGPHs08mnS/dDT4/Z4/Ws3rAfPVVDgp8sps0KeckCIH+qdUrrPrWm8VWlLYsgaUnFzoc+ieAI2XH3CPmUF8wpRBceorZG6xl0s9gPAGfK5IGzvBW6j0GKvkERhaxjK2WxAHBcu5cZnE5nDRAthxNgLhfEZxWMFsr7xQhInIYGgwnEJCtmsHITYi6G5UBaOgySe8A2tW8ViE6YjMPB7X3ao7SfOFN6XLJMFE7yHbbvfnveZn1s9803gvi5lUVpBCXT4he96a4I4lNGLRDTEmtg+fAJ+GMwsh5qiQFAAh1iCuNksd7N3+dwtwiJsvqA9Mbbj/D8Bpon0qzEEQV6UsWMUVjfdR1OviZS/7NCyZ8jACNMfVZcLZ4R/tT3phvWK7IMvPg6cBRgOxzBcPZhzmGDru/nVkbS/AZD9VIsZ4wUx/KvdT2GJZMmv91fKZqB+EoMWXt3r9HfmM9L4qF3RJ2zg6DoJLNCewoc6i6HcIoooRhJ+hf4eR0dwav//K1ZFnV X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR03MB6423.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(346002)(136003)(376002)(396003)(39860400002)(451199021)(66946007)(478600001)(6916009)(4326008)(66556008)(66476007)(8936002)(8676002)(5660300002)(54906003)(26005)(316002)(6486002)(41300700001)(6506007)(6512007)(1076003)(6666004)(4744005)(2906002)(2616005)(83380400001)(186003)(82960400001)(86362001)(38100700002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?8oB5uMtHVrc93D1wDqBstHss+W/2?= =?utf-8?q?j5PNYRVaDfQz8HOPrpk6kvlgEZzcEcwU1a9I3XwR43kRX4qgVSQk1GFppM/0rr7Ql?= =?utf-8?q?OfL3VY4lE1bXB2t7Qexkj5ceD0tgihc1GwAxlR3yt07ve8F0yJ4o1ZQ4iF1tDkOFy?= =?ut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X/d?= =?utf-8?q?W99b9w0gAAPpr73ZV+1jP2tx9WhV6THpJJIyOyqCX/c8eIjg9Ao/QnUw/TVtenI7h?= =?utf-8?q?icrZnZHiXWRFWCbxtbZPYwSabXaZ21b0UWHv8ZaKNwIHQCrpieSIBNJl7vquhXz/H?= =?utf-8?q?yuMhzuHBgbvUJARjH86WObSIHYqcgMz1B8hhW3BzYAdrRWoCBoZuY7kODAHbstltf?= =?utf-8?q?k4XQg0CbAqpt12cSFNQy+iG8CAQoYeNjDaODh8+dmQF3k7seHkrVyh2aTF2DF2Ps3?= =?utf-8?q?cHFmQr/5GlCLR8Psh4ciq7zbWBo1pGQKi4ZLv6ANhOsTCMXKmJU4QjY1bEIe8LunM?= =?utf-8?q?yzx5d3SzdqeqIMENc7lT3getHk8NnFkkj0M+2o2eGmEtn1TExnRPhwlwuQS4sPzDq?= =?utf-8?q?p64LyYZ7EfHPCEf4U5ffAbyYTjcTL3I2s8CaJM9mthRrBzJ2JcU7J2N+mdZVXH9Ds?= =?utf-8?q?C5RwfDl2HGEAFS5bUnj9eTf2filZJCcnMfpPGXwjcyNQRND/q20VmcukKKpv3xgzu?= =?utf-8?q?1gOLmhwrTBqO?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: AjUUiXcFRpdMeSKgSajmXsz4BmMVpckldXNwuYoGe75+IPSZFjD2WP03m0ZywQ8bQglWkICG0SDsv5VI2LwxKJsdlCsmjpedyB+rzirpg6sI+MYY8jPixhn65igQpQl1HjYuo85KZFh2F5omEVM0swZWpjUY2CowTNokDdsjG2qi6pCBr54HA0OaQp5DDM8NkHyd2n81VZUor2oiK2/fjLz6oBKYG+qrJ4r8wxUpTPhPvujRAoh7GGu9pGszJkKNhbcjU78Y3TFdvjlXa6uR1Cc+p8Ad+Q44eXe2RY0fYQJp77qbwexW5EHUr4e5NGdeO6qspE5UQ7BQdmbudlnPn1CjhDiphPjwAxl8L1tJIJ+rdZ8B/XYi1MJx3fHaD/dfuzOZZa3XhFby7taVgf4EuQEJou/M27EtIr3EcI0O27bUF3TsQzp2m5v9D8XJdjgeQsXrHNjTXDzMfkTpD/3s/VdZCz15SkPtAaTGbxH/7NSzLxUptJPZxsRpWCTS3hYxV47fQI7xjEK6KuPkLPMmEqwc1PMMr+FSqc8OBtBhgcjIt1qg/mbakiL8bA8WJsIC2KvqQR0wO6ChLE+MUzOkBSVqF/PX1NLR7gMHanPxYgt0Vr2l31Fx2C0CxJ1ZDnZazsBmaBQ+n+xM8Fs3czSe3wbaH9Q/W2HYtczD3B8uZ/PaEc1qalzkzH5ys3bznw+A2WwSslEXQr0GtXBVnzI24kZrzMySxaVlSZ6/PZwJdsGrZSvc0+vwNn63JEcx8xQfUrpFKe2TwgxUTBwbFA77aDxCy+GRF47nOlSq01kLFunBMo+//1ou92mP3x7DfY0F X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c1b70f1-3cd6-465e-e30f-08db507d2145 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR03MB6423.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2023 11:04:16.3394 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1V2cJUBiBeRF0Ge5aN1gl3E+MGKefI8owauUa9L2m5jQuCbtPcm9ulqp5Epgk44QtattS9tagztyyXAMfQ2C5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR03MB5368 The 'i' iterator index stores a pdx, not a pfn, and hence the initial assignation of start (which stores a pfn) needs a conversion from pfn to pdx. Fixes: 6b4f6a31ace1 ('x86/PVH: de-duplicate mappings for first Mb of Dom0 memory') Signed-off-by: Roger Pau Monné --- xen/drivers/passthrough/x86/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c index cb0788960a08..6bc79e7ec843 100644 --- a/xen/drivers/passthrough/x86/iommu.c +++ b/xen/drivers/passthrough/x86/iommu.c @@ -406,7 +406,7 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d) */ start = paging_mode_translate(d) ? PFN_DOWN(MB(1)) : 0; - for ( i = start, count = 0; i < top; ) + for ( i = pfn_to_pdx(start), count = 0; i < top; ) { unsigned long pfn = pdx_to_pfn(i); unsigned int perms = hwdom_iommu_map(d, pfn, max_pfn);