From patchwork Tue Aug 24 14:27:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12455217 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F31BDC4338F for ; Tue, 24 Aug 2021 14:27:29 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A28F56125F for ; Tue, 24 Aug 2021 14:27:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A28F56125F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.171517.312986 (Exim 4.92) (envelope-from ) id 1mIXOa-0005UE-E3; Tue, 24 Aug 2021 14:27:20 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 171517.312986; Tue, 24 Aug 2021 14:27:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mIXOa-0005U7-B6; Tue, 24 Aug 2021 14:27:20 +0000 Received: by outflank-mailman (input) for mailman id 171517; Tue, 24 Aug 2021 14:27:18 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mIXOY-0005TS-AF for xen-devel@lists.xenproject.org; Tue, 24 Aug 2021 14:27:18 +0000 Received: from de-smtp-delivery-102.mimecast.com (unknown [194.104.109.102]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1bf81538-43f9-4e9c-a227-2471f8545398; Tue, 24 Aug 2021 14:27:17 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2109.outbound.protection.outlook.com [104.47.18.109]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-9-v6lPtcefM5CDPuJcGu0F9g-1; Tue, 24 Aug 2021 16:27:15 +0200 Received: from AM0PR04MB5587.eurprd04.prod.outlook.com (2603:10a6:208:125::12) by AM0PR04MB5586.eurprd04.prod.outlook.com (2603:10a6:208:130::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.22; Tue, 24 Aug 2021 14:27:13 +0000 Received: from AM0PR04MB5587.eurprd04.prod.outlook.com ([fe80::4822:460f:7561:33bf]) by AM0PR04MB5587.eurprd04.prod.outlook.com ([fe80::4822:460f:7561:33bf%5]) with mapi id 15.20.4436.025; Tue, 24 Aug 2021 14:27:13 +0000 Received: from [10.156.60.236] (37.24.206.209) by AM3PR07CA0104.eurprd07.prod.outlook.com (2603:10a6:207:7::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.6 via Frontend Transport; Tue, 24 Aug 2021 14:27:13 +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: 1bf81538-43f9-4e9c-a227-2471f8545398 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1629815236; 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=ekc106SeN5rQ4+mKbVywQpGio0tLIHNqkbPDTkhzXTA=; b=WnurmuG/rHc80zSPienleiKbu8WsHcALwZszMfGJ1pXDdJGXsQqnKWs0bZXC+6k+j6mMFD VHuBbx+IgNHzdElLPRw7woprQ/9UKaUDh9PXjW8jkww5+Uy53E5wrEIqx1MCTQxvFop5JQ 6NOwkLAS43Uw9cXu/nwNdzWDx25utZk= X-MC-Unique: v6lPtcefM5CDPuJcGu0F9g-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lrm3e6A5wvAUsNu83p6gsmlp44wd9x7J22oJaT4Z91czIqCAqQbgKonA/e7eIfH9DHP1uu0QXrDkTWsyK42VftZ0/ssJIGtGKK317BMbfx1ka6OItm5187QU5OTQ81KO61b8tx8kXu/0UD0LmHv8M9t/97y8lZ5tUuoX8AHDSTGTimBIb1BYLh0llKvMTYGtFVIuU2Ps0Zk5o5KnUSaWv2f5Nn2/ZsQqyEIpYJj8Vd5UqlDVeXiW7IoOqcBK6B/hI8g1FIk6O0EqcD4TTrltYoah7Ggmh/atYxO6LekDSdHceahWVnrxf7RPwMpV6f9mm86ybNZ3iYCGHIE9/VvnNQ== 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-SenderADCheck; bh=ekc106SeN5rQ4+mKbVywQpGio0tLIHNqkbPDTkhzXTA=; b=ZtuX8vqgWMuCVBdRDUtVigE0Gva21eFEEYDLPhK1ZDF1wbdtC4pDF0LgWr0t81oPejBMsZ+g6g3uGdI2ZzncUbKIc04IVn+dYN5WrkuXG4KiAeYTkYwLVwMB26m4aXIGrdTtgCLq/L27i/TNTutCWQDpYdFnLyguHmUXTCmGB73HOqU031+n3Th3vxxDG/caKzhUdMRGyNTFc5iMIXFwXxJ8oGQ9CX0TPpUDhLeukwXF2pTwNuYNRg2nFaNd36F05lupZ4sOgWI88STHaruVl2QcPH1s2SiLRyFrTMch+9II9yp1IUDvg7LuaNHflLK7xYK3tzgMp5E2TXJGmJg4Sg== 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: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=suse.com; Subject: [PATCH 16/17] VT-d: show permissions during page table walks From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Paul Durrant , Kevin Tian References: Message-ID: Date: Tue, 24 Aug 2021 16:27:12 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: Content-Language: en-US X-ClientProxiedBy: AM3PR07CA0104.eurprd07.prod.outlook.com (2603:10a6:207:7::14) To AM0PR04MB5587.eurprd04.prod.outlook.com (2603:10a6:208:125::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a1db4cfe-8a33-4cc0-ad62-08d9670b443a X-MS-TrafficTypeDiagnostic: AM0PR04MB5586: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:913; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Vi4vuJzXxMxq26AOxxsXIwuoIy8VuFEZomq+bypJ4nvr2w0vdbObSNNMGdta9Vv8+iXjleZndJAkEkXH/OBuTTF0BnWF57tgn+q9Slw9B1nzz26SsD+VbTLrJKz29kRGZP6l6J2meQc8Tze4U6BDPuO0wW2pLLI0rJ/aBuUNdO+0wiSx3d6XUnju9BCt7WqaNu45gZk8k5/v8b8ULI/tf8lH9bPtxNt3V3IpF7uWQcmNPlvd5c7OMns+2mWwP4eOFcH2wT7f3Mwjr1MwERnmljI9j3N3S7uT+7c1n8BYMpt/gssa4e58iCU4Ax6v82PxffB1YI9nqRwIpCw+XRVogjig0DBaO7BbWw8t5cCKLovspMZk7TEjIPoQnpTRiQvAu20oLaTs6ZY1tHXu7eBlpdUwcUIGoiETbc/FPsuDd+QQYsKsRsF0lwHRG4skEvdj025Mne8UQ6Xiqdk+u2WsitfoY4KShCJmIJNnOJ/63DuAV5JiyXpCQRTJ6DAnfV9KMFHY8iLDCkVjnKVxwdEpcNTsCNXA0R7/3yj3iMDp7zRQ3nsYf6aBlTtGCh9s7/jc93GPTw1RsZZfCpUQW7kbRwvNr2cHWTHXbBpEpW9CbiqyDEssPYSZ4nUW8ActCzdPUTXvmy9qO8BSg9TebzSEha+HdzmmDu75RVh+qy37YcWJEdSLpDNiA/gNgNLRr6q3ueW2VoGmYfP6w+Kb8gQVpNqIxi1N2vE9tx7CwrIQLLA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB5587.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(366004)(376002)(346002)(136003)(6486002)(6916009)(478600001)(31696002)(956004)(4326008)(36756003)(2906002)(38100700002)(316002)(66946007)(26005)(8936002)(66476007)(66556008)(5660300002)(31686004)(16576012)(54906003)(8676002)(186003)(2616005)(86362001)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?kc8VSpWHsgATHsMku+Jfrvvp3n/m?= =?utf-8?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?utf-8?q?Z190/lhnwTH8i+0l53KTwrtG8aNcniVzZYXRER4x82/ZZS4cQEILlhu16ZJU1GDLc?= =?utf-8?q?oJdg7zSy0oWKCqDagFYEEzjMEyo3UfVJnlxOirq2zBoXYd4GdM8bTQvZmS7Bf/bOR?= =?utf-8?q?TFEs4FM+LWK66UJoihfOczuaFS9JMC1JgovVcXuoa6JlOkOBhMVRQscQdFMCDcYFI?= =?utf-8?q?ZTbABUvqQ+khtEkK1zWNnG9gF0+lq5AGUBiEH4ujOLTUfEcDTlSXfjeWoY8yj3BWn?= =?utf-8?q?KTgK3qx8Qigo7pK+c104sJp0MltIvV/VU3wJSG9eCDp93FjCzFZtNUnelYT0/FW4B?= =?utf-8?q?gXYNV3uRD2v/S/Dfr/53S8dmtdXD7buqSfnlFjDh7RtZ0GmXkIcf0G6a0zBwoeM/A?= =?utf-8?q?eTznkkP3bto7fkA9?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: a1db4cfe-8a33-4cc0-ad62-08d9670b443a X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5587.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2021 14:27:13.7482 (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: 48UJ3ztd7+K5HHRdKcxqUamBc1p/uAMa4dxgpy3PxJiYil59IfbCZK30V2OWVngOKvQ4FIwR3uXyHekSa98Rbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5586 Besides the addresses this is the next crucial bit of information one might be after. Signed-off-by: Jan Beulich Reviewed-by: Kevin Tian --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -2822,10 +2822,12 @@ static void vtd_dump_page_table_level(pa vtd_dump_page_table_level(dma_pte_addr(*pte), next_level, address, indent + 1); else - printk("%*sdfn: %08lx mfn: %08lx\n", + printk("%*sdfn: %08lx mfn: %08lx %c%c\n", indent, "", (unsigned long)(address >> PAGE_SHIFT_4K), - (unsigned long)(dma_pte_addr(*pte) >> PAGE_SHIFT_4K)); + (unsigned long)(dma_pte_addr(*pte) >> PAGE_SHIFT_4K), + dma_pte_read(*pte) ? 'r' : '-', + dma_pte_write(*pte) ? 'w' : '-'); } unmap_vtd_domain_page(pt_vaddr); --- a/xen/drivers/passthrough/vtd/utils.c +++ b/xen/drivers/passthrough/vtd/utils.c @@ -159,14 +159,11 @@ void print_vtd_entries(struct vtd_iommu l_index = get_level_index(gmfn, level); pte.val = l[l_index]; unmap_vtd_domain_page(l); - printk(" l%u[%03x] = %"PRIx64"\n", level, l_index, pte.val); + printk(" l%u[%03x] = %"PRIx64" %c%c\n", level, l_index, pte.val, + dma_pte_read(pte) ? 'r' : '-', + dma_pte_write(pte) ? 'w' : '-'); - if ( !dma_pte_present(pte) ) - { - printk(" l%u[%03x] not present\n", level, l_index); - break; - } - if ( dma_pte_superpage(pte) ) + if ( !dma_pte_present(pte) || dma_pte_superpage(pte) ) break; val = dma_pte_addr(pte); } while ( --level );