From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 7E057C433EF for ; Tue, 19 Jul 2022 13:31:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UyHANaID7kuRMLGGE8NWzglktN2Py/RX73OE66f+er0=; b=oJxPmIWbqEeJYe +kwYqaAWg4nQLaNiJaUhy/DFhra5qbhT3qk0xcA7Z2lkDrF9Fr7+JftRC2AUVlz670wXvY7aduTjP gEIMVrK8QLtN36DMUoEIbBAYeTlGZs+BWfKTssT3pqbrDyqLjTWxCdp8YDBxunXYOOTU4Ju8jRqUZ jIVHnVqE6VU4w3g5weuLHQIfrqiOpxAMfb5pwPnK3pVXkS/zPDp71rIcINP9ANxNl3s5j03J4zK7T Z/hsvEX8DIQPVPDuGo22ZqShUt+/D2VmlYxpdaTpHhxVA5hxL2p3rQQVh8frCTa09ATkLnGfwJUQQ IeaszdmRjslIFd+aDWAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oDnJ0-009DI3-0F; Tue, 19 Jul 2022 13:30:30 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oDnIx-009DDQ-D9 for linux-arm-kernel@lists.infradead.org; Tue, 19 Jul 2022 13:30:28 +0000 Received: by mail-wr1-x42d.google.com with SMTP id z13so2030432wro.13 for ; Tue, 19 Jul 2022 06:30:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=aeU9cgOyyIosd32FJcgD+fpFlGUSWOLfdLntVffrwYI=; b=hux2JLvdiv0cwO+vggf9NbJXBqDg2Ko8RqWrIxcttc9Hg0kU7gZtV0HtaGsYzMJN5r 2xw+PCxakX3m3q/UPEjcRkRQGRkSeFJ2fEGDqyoqsTV9ixkD9v22Id1hMmzBNtUiDsV3 Kop16VLrqGjXK9trmzw+2iuf+R8SFC6k5cm5xvtgAuXyR91yLdQxFt2Hks/xD4SMcbkv RpHxN4o4uYg7HOFYDEMnt50EWgUaPHUff6hQbVOVbFrvUGHzC8sDXcIeXO3S3TfcfB5Z L1h4cAf1nwg7RFdkmLR5r6js+oMs8hZj+72cbkaDTBShuQV8VpQ63RwhZpWHg6bc1V60 GlHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=aeU9cgOyyIosd32FJcgD+fpFlGUSWOLfdLntVffrwYI=; b=tP/PpeNltEvy28iqir0qBWiI3Vo4bzS+vJ4lK3atPd7df3j2dS9areCIaJzFypj0GT rfRplZxVYyDkyEt0TqbPjzxKQzjqPC+O6R7dm3YX64I/2J08eU/VS5KesOO42fnXzdoP 8ceMQe9zraQ0gQTQLB1VcInRspAVopWBybtLvuY//PLd+Fde+Bs78187XByFhfJA6G9k RU5zP8teFP2bvJss+DLG9s6pxqMfascYBEjS8Z9Fa3KDVqDyUdZ76kkVAcWe2IdF+caU Ms0gpE666xFuLXMH3KAHLdx+IWhWEhimHvt/0dlstBq/LP+KcoOLRTwIMgxbTvsUXn7Z /osQ== X-Gm-Message-State: AJIora9sX+TH8iIS9JxXx5WNHMOEWuN+cR8OSMZr8BBBSfHcj7h6xpW8 OZ92RDY/n1tGalCXrCRsWx3+VQ== X-Google-Smtp-Source: AGRyM1vzvLKgd/6l5pxRFRCv0etdl5tPYv3bpkSlMQO5Lp/Wf3UVXLnmW9wvqkKhdX+dMbee37E47A== X-Received: by 2002:a05:6000:1541:b0:21d:b298:96be with SMTP id 1-20020a056000154100b0021db29896bemr26549092wry.206.1658237421084; Tue, 19 Jul 2022 06:30:21 -0700 (PDT) Received: from google.com (109.36.187.35.bc.googleusercontent.com. [35.187.36.109]) by smtp.gmail.com with ESMTPSA id b14-20020a5d40ce000000b0021a56cda047sm13475885wrq.60.2022.07.19.06.30.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 06:30:20 -0700 (PDT) Date: Tue, 19 Jul 2022 14:30:16 +0100 From: Vincent Donnefort To: Will Deacon Cc: kvmarm@lists.cs.columbia.edu, Ard Biesheuvel , Sean Christopherson , Alexandru Elisei , Andy Lutomirski , Catalin Marinas , James Morse , Chao Peng , Quentin Perret , Suzuki K Poulose , Michael Roth , Mark Rutland , Fuad Tabba , Oliver Upton , Marc Zyngier , kernel-team@android.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 14/24] KVM: arm64: Add pcpu fixmap infrastructure at EL2 Message-ID: References: <20220630135747.26983-1-will@kernel.org> <20220630135747.26983-15-will@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220630135747.26983-15-will@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220719_063027_480363_33D05016 X-CRM114-Status: GOOD ( 15.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > static struct hyp_pool host_s2_pool; > diff --git a/arch/arm64/kvm/hyp/nvhe/mm.c b/arch/arm64/kvm/hyp/nvhe/mm.c > index d3a3b47181de..17d689483ec4 100644 > --- a/arch/arm64/kvm/hyp/nvhe/mm.c > +++ b/arch/arm64/kvm/hyp/nvhe/mm.c > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -24,6 +25,7 @@ struct memblock_region hyp_memory[HYP_MEMBLOCK_REGIONS]; > unsigned int hyp_memblock_nr; > > static u64 __io_map_base; > +static DEFINE_PER_CPU(void *, hyp_fixmap_base); > > static int __pkvm_create_mappings(unsigned long start, unsigned long size, > unsigned long phys, enum kvm_pgtable_prot prot) > @@ -212,6 +214,76 @@ int hyp_map_vectors(void) > return 0; > } > > +void *hyp_fixmap_map(phys_addr_t phys) > +{ > + void *addr = *this_cpu_ptr(&hyp_fixmap_base); > + int ret = kvm_pgtable_hyp_map(&pkvm_pgtable, (u64)addr, PAGE_SIZE, > + phys, PAGE_HYP); > + return ret ? NULL : addr; > +} > + > +int hyp_fixmap_unmap(void) > +{ > + void *addr = *this_cpu_ptr(&hyp_fixmap_base); > + int ret = kvm_pgtable_hyp_unmap(&pkvm_pgtable, (u64)addr, PAGE_SIZE); > + > + return (ret != PAGE_SIZE) ? -EINVAL : 0; > +} > + I probably missed something but as the pagetable pages for this mapping are pined, it seems impossible (currently) for this call to fail. Maybe a WARN_ON would be more appropriate, especially the callers in the subsequent patches do not seem to check for this function return value? [...] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel