From: Claudio Carvalho Date: Mon, 15 Jul 2019 00:38:48 +0000 Subject: Re: [PATCH v4 6/8] KVM: PPC: Ultravisor: Restrict LDBAR access Message-Id: List-Id: References: <20190628200825.31049-1-cclaudio@linux.ibm.com> <20190628200825.31049-7-cclaudio@linux.ibm.com> <87h87sg24k.fsf@concordia.ellerman.id.au> In-Reply-To: <87h87sg24k.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Michael Ellerman , linuxppc-dev@ozlabs.org Cc: Madhavan Srinivasan , Michael Anderson , Ram Pai , kvm-ppc@vger.kernel.org, Bharata B Rao , Ryan Grimm , Sukadev Bhattiprolu , Thiago Bauermann , Anshuman Khandual On 7/11/19 9:57 AM, Michael Ellerman wrote: > Claudio Carvalho writes: >> When the ultravisor firmware is available, it takes control over the >> LDBAR register. In this case, thread-imc updates and save/restore >> operations on the LDBAR register are handled by ultravisor. > Please roll up the replies to Alexey's question about LDBAR into the > change log. > >> diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S >> index f9b2620fbecd..cffb365d9d02 100644 >> --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S >> +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S >> @@ -375,8 +375,10 @@ BEGIN_FTR_SECTION >> mtspr SPRN_RPR, r0 >> ld r0, KVM_SPLIT_PMMAR(r6) >> mtspr SPRN_PMMAR, r0 >> +BEGIN_FW_FTR_SECTION_NESTED(70) >> ld r0, KVM_SPLIT_LDBAR(r6) >> mtspr SPRN_LDBAR, r0 >> +END_FW_FTR_SECTION_NESTED(FW_FEATURE_ULTRAVISOR, 0, 70) > That's in Power8 code isn't it? Which will never have an ultravisor. IIUC, it might be executed in Power9 as well, but I can double check that. > >> diff --git a/arch/powerpc/platforms/powernv/opal-imc.c b/arch/powerpc/platforms/powernv/opal-imc.c >> index 1b6932890a73..5fe2d4526cbc 100644 >> --- a/arch/powerpc/platforms/powernv/opal-imc.c >> +++ b/arch/powerpc/platforms/powernv/opal-imc.c >> @@ -254,6 +254,10 @@ static int opal_imc_counters_probe(struct platform_device *pdev) >> bool core_imc_reg = false, thread_imc_reg = false; >> u32 type; >> >> + /* Disable IMC devices, when Ultravisor is enabled. */ >> + if (firmware_has_feature(FW_FEATURE_ULTRAVISOR)) >> + return -EACCES; > I don't mind taking this change. But at the same time should the IMC > stuff just be omitted from the device tree when we're in ultravisor mode? Yes. Maddy said that he will patch skiboot to remove the IMC nodes if ultravisor is present. I added this check just to protect the kernel in case skiboot is not in the right level for some reason. Thanks, Claudio > > cheers >