Message ID | 20240211174705.31992-4-ankita@nvidia.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78827C4829B for <linux-mm@archiver.kernel.org>; Sun, 11 Feb 2024 17:48:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D3FFC6B007D; Sun, 11 Feb 2024 12:48:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CC8DB6B007E; Sun, 11 Feb 2024 12:48:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B1D276B0080; Sun, 11 Feb 2024 12:48:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 9F0C96B007D for <linux-mm@kvack.org>; Sun, 11 Feb 2024 12:48:00 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4647B1608A1 for <linux-mm@kvack.org>; Sun, 11 Feb 2024 17:48:00 +0000 (UTC) X-FDA: 81780256320.12.DEF7DE8 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2070.outbound.protection.outlook.com [40.107.237.70]) by imf23.hostedemail.com (Postfix) with ESMTP id 69683140002 for <linux-mm@kvack.org>; Sun, 11 Feb 2024 17:47:57 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=EtCuoswo; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf23.hostedemail.com: domain of ankita@nvidia.com designates 40.107.237.70 as permitted sender) smtp.mailfrom=ankita@nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707673677; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=GEUPBUp/mRSrwoBY6hHPxBFvFm1Cd4dE+qw16gP2bsw=; b=bCwZqsMFTZL+AZwawVoR1yFDeFofTHbMoGXVrkpuOkoEsBM/YL4TV5JgQzDNQjJc0psm5K RNKL2tXApp2jtzTb+rPNYruQC5S1rvgR+PuUweQ/yO/mN4c0PPa8qHs+WGwdrcgyrmBrR5 HfZ1nssn/9prSdgBv8xOzv1Me8T/Aqg= ARC-Authentication-Results: i=2; imf23.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=EtCuoswo; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf23.hostedemail.com: domain of ankita@nvidia.com designates 40.107.237.70 as permitted sender) smtp.mailfrom=ankita@nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1707673677; a=rsa-sha256; cv=pass; b=dzGWHnSYV4LqSgD3XajGGVK9OaTbfy5bi9m7IOOMquzJMosYGIS4z1yx/qAWO+xXFtQVhk Z43gwGSOTJGfMJCeq6/XRIlQJnvQaip+JMJhfXCuv8T6xWs09jl91T/Y/VGrN1VMnPb7Ct m5T9MFsKvicc5cQ3XKms+EmrvnmFdAI= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nEzsiuYFjSP8N4G5X5fjz1Ur1/N3qfKNECA9J6NbAjHkvXT866wLPKgq2H8q78RRTPgX6YpoEbQ2Smdt3x8AutDP0rkzJ9HdCehhSxozXhxdF9cAtWdk0eBdp6zzFaGrfI5pP8QiyYWmve6llN4raPYPFNMB+kf2hm4LzyBFGIC0+FQ4V4Ixw3kc1oi816xn1FN0bYw2gbYK3GmIH2OzXnQSAKBSpKob/en3wADXGrKxRDzydshvN1JSN8nU6r8xUMPTumzQ1bjo+aqfV+74367fOOwinLIytojx7Z2AqK9/EgJitvjN1HQ5OkUUonr7zPC5OSXM7GxxYet3rEeMhg== 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=GEUPBUp/mRSrwoBY6hHPxBFvFm1Cd4dE+qw16gP2bsw=; b=eiqQKPjOsGjX/jhWgG+ETYhHlcmVZdb2UEWHxnKF/UIHhrE3DwV95hYtUyI5qA0Gg4QlqxSMkaR49PYlS3S94obsy0OkvZh5dj60U0Z45FzDdfuNmDQCbtBMhIaJWecCdevVYn1lHQhQLyTEJC3nWKTX/6tFOaa1DtoIoz1vbDaeEtXdFaqnw1cZNuSHs9m6YNK100jsIjpRPrzRRtz2awdmhqTXMpphgoL2gcA2WM7lMrJHtG9NXauE4JKj5pOqgN4qjS8JOy9upckSBzJabbE72jyOjwHK19fvNLsTJUM1KbDIsh6Im3+BIcZLDZC8J9jXrFMifgn1XbUQTgEyJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GEUPBUp/mRSrwoBY6hHPxBFvFm1Cd4dE+qw16gP2bsw=; b=EtCuoswotMWpcrle1XP1yr9Eku3RnAE5vjr5yOJiRtAATzvKfW5tJ7FTL2sCnsys6TxFrMmATmyEbs8T6ai7UauzENkDL6T2kE7jhaMY4uokHu/KS8/+kXq4LuU5WifJxa3hkqrKlnNDtkkOd4F3hX/46rXJp/8luql+6/t8vLxvn48kHE/vxBDBPaN+iH2JnOZObgfZSuM3gv1t+bzfAWWS4rUuaTVplWQWa3xTtgeyygtuabbmoNAZRop9h8Vfmue1+4RY91XcS1+ZpH0cW7C7eUT+CxP3DdNFlytLzJwI7Hql68XsWubSjHMGMI+5jk0U4wGu5xPGSCprPiYv5A== Received: from DM6PR03CA0054.namprd03.prod.outlook.com (2603:10b6:5:100::31) by SN7PR12MB7225.namprd12.prod.outlook.com (2603:10b6:806:2a8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.14; Sun, 11 Feb 2024 17:47:53 +0000 Received: from DS3PEPF000099D6.namprd04.prod.outlook.com (2603:10b6:5:100:cafe::81) by DM6PR03CA0054.outlook.office365.com (2603:10b6:5:100::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.35 via Frontend Transport; Sun, 11 Feb 2024 17:47:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by DS3PEPF000099D6.mail.protection.outlook.com (10.167.17.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.19 via Frontend Transport; Sun, 11 Feb 2024 17:47:53 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 11 Feb 2024 09:47:53 -0800 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Sun, 11 Feb 2024 09:47:52 -0800 Received: from sgarnayak-dt.nvidia.com (10.127.8.9) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12 via Frontend Transport; Sun, 11 Feb 2024 09:47:41 -0800 From: <ankita@nvidia.com> To: <ankita@nvidia.com>, <jgg@nvidia.com>, <maz@kernel.org>, <oliver.upton@linux.dev>, <james.morse@arm.com>, <suzuki.poulose@arm.com>, <yuzenghui@huawei.com>, <reinette.chatre@intel.com>, <surenb@google.com>, <stefanha@redhat.com>, <brauner@kernel.org>, <catalin.marinas@arm.com>, <will@kernel.org>, <mark.rutland@arm.com>, <alex.williamson@redhat.com>, <kevin.tian@intel.com>, <yi.l.liu@intel.com>, <ardb@kernel.org>, <akpm@linux-foundation.org>, <andreyknvl@gmail.com>, <wangjinchao@xfusion.com>, <gshan@redhat.com>, <shahuang@redhat.com>, <ricarkol@google.com>, <linux-mm@kvack.org>, <lpieralisi@kernel.org>, <rananta@google.com>, <ryan.roberts@arm.com>, <david@redhat.com>, <linus.walleij@linaro.org>, <bhe@redhat.com> CC: <aniketa@nvidia.com>, <cjia@nvidia.com>, <kwankhede@nvidia.com>, <targupta@nvidia.com>, <vsethi@nvidia.com>, <acurrid@nvidia.com>, <apopple@nvidia.com>, <jhubbard@nvidia.com>, <danw@nvidia.com>, <kvmarm@lists.linux.dev>, <mochs@nvidia.com>, <zhiw@nvidia.com>, <kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org> Subject: [PATCH v7 3/4] kvm: arm64: set io memory s2 pte as normalnc for vfio pci device Date: Sun, 11 Feb 2024 23:17:04 +0530 Message-ID: <20240211174705.31992-4-ankita@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240211174705.31992-1-ankita@nvidia.com> References: <20240211174705.31992-1-ankita@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099D6:EE_|SN7PR12MB7225:EE_ X-MS-Office365-Filtering-Correlation-Id: 9328e4e7-c2b8-4281-f93b-08dc2b2992e9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AhSeR5BaxNzG0QKrNhr7kPTxSNWm9QP170YFV72q5ODiA4Y1hSL7BppZPD7U14QobLia8LrifmyWzg4OzDLz5p2XhefJqXX5rhz7HZq3TUh+h32imnfEgh3agJAPc8qcXl/UfRms7q/jR8EYl6cBjCdjxk3wfKDi7/cdU3ocw0To/6hlZXYs7mK8fMmqzv/kcJso1BGTxaF/DEoDv+MwxxGSsCbYyxkxsD3w8Alz/OLrcxwhuF0bVAlVmI0iQpQ+lUx58AMJ7JBlA5dk2V4Sr0Lo3LePXECONE0nj9/ZAhEu9XBsrRGcupE60UKh8g1g/i5FkmkypVW/J90tvUhvvZccZjewmCbgwRbKnjebqy3U3fwQLmWO+R6z0pKeHw/hVNptqHbuMEA6K8s9FviUZ5Kt9i7JdJlKAHsICvkXXcNwrbn0gcrQ+LRHOEkWp+2MpjNXVwAzg33sk4nD2pxL6UNSVOO1z2xKsBvoMRV8VmwDbB44uZAse1Red/dRlAKi7pKsNBJuO1IteA+9AsXunLMOOLcP8A9OdDpqv6cTtL8k7BR+jELYQur/x+LMqsureYsk2yGkM9HgjItcuPpJJJas02+YpHdMxzVqstdTDZ4R3b+paz2MqfNSdiqZEmoPw5btCR0Px5o6avPd6wAG+w== X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(376002)(396003)(136003)(39860400002)(346002)(230922051799003)(451199024)(82310400011)(186009)(64100799003)(1800799012)(40470700004)(36840700001)(46966006)(36756003)(921011)(478600001)(5660300002)(7636003)(7416002)(41300700001)(70206006)(8676002)(7696005)(1076003)(426003)(26005)(54906003)(2616005)(83380400001)(356005)(2876002)(336012)(2906002)(4326008)(110136005)(6666004)(86362001)(7406005)(70586007)(316002)(8936002)(82740400003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2024 17:47:53.7134 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9328e4e7-c2b8-4281-f93b-08dc2b2992e9 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099D6.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7225 X-Rspam-User: X-Stat-Signature: 6br1an7zh1m5gtmf6wu5mxcwmycsxaa8 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 69683140002 X-HE-Tag: 1707673677-700155 X-HE-Meta: U2FsdGVkX1/SKYoC65sYuaJY+ejwB6W7pZDsHanesdKAQvg40eX+Uzb/jixp+8jfkUYW0OTbRt5ykCJ1UIEWRK2vDTacpLP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B/jCYRcQ80UQewQ/DYH2ddPm7eKwegfMF5htBCjLp0uFWUysKbSRpIUntMymwOCjMbiKYtegYuL2pg0l0okqLjg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
kvm: arm64: allow the VM to select DEVICE_* and NORMAL_NC for IO memory
|
expand
|
diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index d14504821b79..1742fdccb432 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1381,7 +1381,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, int ret = 0; bool write_fault, writable, force_pte = false; bool exec_fault, mte_allowed; - bool device = false; + bool device = false, vfio_allow_any_uc = false; unsigned long mmu_seq; struct kvm *kvm = vcpu->kvm; struct kvm_mmu_memory_cache *memcache = &vcpu->arch.mmu_page_cache; @@ -1472,6 +1472,8 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, gfn = fault_ipa >> PAGE_SHIFT; mte_allowed = kvm_vma_mte_allowed(vma); + vfio_allow_any_uc = vma->vm_flags & VM_ALLOW_ANY_UNCACHED; + /* Don't use the VMA after the unlock -- it may have vanished */ vma = NULL; @@ -1557,10 +1559,14 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, if (exec_fault) prot |= KVM_PGTABLE_PROT_X; - if (device) - prot |= KVM_PGTABLE_PROT_DEVICE; - else if (cpus_have_final_cap(ARM64_HAS_CACHE_DIC)) + if (device) { + if (vfio_allow_any_uc) + prot |= KVM_PGTABLE_PROT_NORMAL_NC; + else + prot |= KVM_PGTABLE_PROT_DEVICE; + } else if (cpus_have_final_cap(ARM64_HAS_CACHE_DIC)) { prot |= KVM_PGTABLE_PROT_X; + } /* * Under the premise of getting a FSC_PERM fault, we just need to relax