Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp154262ybz; Tue, 21 Apr 2020 06:36:14 -0700 (PDT) X-Google-Smtp-Source: APiQypIkTODqZ8jEqxSoReGqXk/QIGaZl0pDaukgIgAxgTv7S1f2uOBPFiHyW9eCJF2wFpqWBgb5 X-Received: by 2002:a17:906:add7:: with SMTP id lb23mr22238733ejb.6.1587476174551; Tue, 21 Apr 2020 06:36:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587476174; cv=none; d=google.com; s=arc-20160816; b=xrZpGX0WHPVocS6M6g4JuVpfAXbp0xxqUqzlxtcw84g+0GrIfAawUyWyh6pJr2Hd0U quOCjmnQCjKfXq3ZOewSWhPcbZvgfXapIT8d/TT3ftAyCOpHHI/JA5GlyqZ4inlmu7S2 kf14IX2BEOVFXIi3iMCl73ROirx/8wAIwyQpQKIHil7Mt4TRfodzTcEl/oMiUaBH065N 3ZvFpBK0/302d5BKc9PIHSmQyjBBL5c4B55iMt4ghVWXnICTyMG4kuTZ2AzNodX73ooc xDcywjbv9a6NZaKHdWuUNvW9PsubXK+ai8KqYJ4tSTNWIDUeL+vYCUZMJ6TWLHQhStPi wfxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=7Zr1d//0qU7fPU2+8f04Y37nOoBPdlC7SDp06NB3DfM=; b=XLK7v1FOVvzkyDNw7ykkQdpGV6DOwtUfRHRvzES754M6orflQaIKops4QLaTRFhz31 ZTxdxMZovuaaohbcpojfwmnoFBzf9+wg6xpEczTizRqaa5bNgbW3RHfpzdLwD/xrcWDw vBUe0bMpUIG2SJ/SMEfvh+Ohd06E9YTzsbgMIbaNPPtUmcGkXOb3OA5ehCChVM6jJ6Nr gSRAJXiqAtAbyqSkgLKhtmhWZFmQevk/0vWDA+Im5ji8b5yURiR/prrESJx5pzbg7ua3 4Bexv3r8tH8jv+DSIsD26LMplyTaoYeAhegXz9+NFIKULGVubTaW9Jop8c4pUu+wvI9J tgJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=KGVt1GTI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v11si1597756edy.483.2020.04.21.06.35.50; Tue, 21 Apr 2020 06:36:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=KGVt1GTI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728943AbgDUNex (ORCPT + 99 others); Tue, 21 Apr 2020 09:34:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728422AbgDUNew (ORCPT ); Tue, 21 Apr 2020 09:34:52 -0400 Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C794AC061A41 for ; Tue, 21 Apr 2020 06:34:51 -0700 (PDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4964LH5jycz9sSY; Tue, 21 Apr 2020 23:34:47 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1587476088; bh=Y+z6/rcJIObmZtZ51xGieSwpLR256JCEweZeuezbpcY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=KGVt1GTIlQZOPxOIid++1szONXTthboUOft5u/6EE6JysRPJ8O3iv3vAb+Ihm6B41 2cWtWSpLVTDTgAtQYInJePYFBXqa31pJ2H2LtW1YCjjhfeyYaK/1BOM/y63Ndfx61F +2Z05AzNnKItYukVZO6EckdQVK/oQC5HjIxrJss7+2q0YTdpRwbANP94m9qVl1fBQH ZxK5XTabGGImV8mfAnOERHQffGm8D4Z3DOHbFFwTqJqDf006IT8h5JTjmOh/FVjGNp 7M4aWACvFXqgMhLc59XWbdSFubep7HPt419o68jfI5bOs3y4XRQOzUN7zajxALFiDz 5g/ux86TtXjfA== From: Michael Ellerman To: Laurent Dufour , kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: paulus@samba.org, linux-kernel@vger.kernel.org, Alexey Kardashevskiy , benh@kernel.crashing.org Subject: Re: [PATCH] KVM: PPC: Book3S HV: read ibm,secure-memory nodes In-Reply-To: <20200416162715.45846-1-ldufour@linux.ibm.com> References: <20200416162715.45846-1-ldufour@linux.ibm.com> Date: Tue, 21 Apr 2020 23:34:59 +1000 Message-ID: <87k129gdx8.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Laurent, Laurent Dufour writes: > The newly introduced ibm,secure-memory nodes supersede the > ibm,uv-firmware's property secure-memory-ranges. Is either documented in a device tree binding document anywhere? cheers > Firmware will no more expose the secure-memory-ranges property so first > read the new one and if not found rollback to the older one. > > Signed-off-by: Laurent Dufour > --- > arch/powerpc/kvm/book3s_hv_uvmem.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/arch/powerpc/kvm/book3s_hv_uvmem.c b/arch/powerpc/kvm/book3s_hv_uvmem.c > index 53b88cae3e73..ad950f8996e0 100644 > --- a/arch/powerpc/kvm/book3s_hv_uvmem.c > +++ b/arch/powerpc/kvm/book3s_hv_uvmem.c > @@ -735,6 +735,20 @@ static u64 kvmppc_get_secmem_size(void) > const __be32 *prop; > u64 size = 0; > > + /* > + * First try the new ibm,secure-memory nodes which supersede the > + * secure-memory-ranges property. > + * If we found somes, no need to read the deprecated one. > + */ > + for_each_compatible_node(np, NULL, "ibm,secure-memory") { > + prop = of_get_property(np, "reg", &len); > + if (!prop) > + continue; > + size += of_read_number(prop + 2, 2); > + } > + if (size) > + return size; > + > np = of_find_compatible_node(NULL, NULL, "ibm,uv-firmware"); > if (!np) > goto out; > -- > 2.26.1