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 E5552CCD193 for ; Mon, 20 Oct 2025 13:01:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0zFridDRujIk/1Xu79kcNGrw56rHGFeG48YU0bL72x4=; b=repqoQnKMTNezoRHRgwx3hOUb7 6yjohaMUt70GRn/kK9V6jPxpVjt45+XHtzFUnOO5f+YLGXsoSV1JN4SW7oWmiQnOn5X/mfX0gK/Ov NQDJ/WDVa+f0ag/SCDqICrEMyXMgqLSCi/KlhcG4gTcalVVVzjU5FS0UaPWa/JQbDHFAgIpVWGQCq yJ5zivp4DvAvimZTLIRzlY3JDGHTB6VNBhdFWTr1GECkOfQA4rYifdjQBx+9PNv4JYJNM7d6ctk5f 4GSGN+NYSTfMChVxKwUKUPZOpEPBRheh+79YxL5e3qRuefy9tUDp6sVcrP7TEWdOljWUgtOFuYv1O bVOsGhmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vApVp-0000000DhGf-0IkS; Mon, 20 Oct 2025 13:01:21 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vApVn-0000000DhGH-0jLw for linux-arm-kernel@lists.infradead.org; Mon, 20 Oct 2025 13:01:19 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 538D561F19; Mon, 20 Oct 2025 13:01:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8488C4CEF9; Mon, 20 Oct 2025 13:01:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760965278; bh=0SzM7POeZzsGGQ5mWGCo5naisyyNFb+Sx+BZH6gSIJc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=H8pJPmcB/M8iv4RfG9SDzfYjcT/VZrk6Du9GXGrHrZNFKRjD8Jw7upRZ9ORP9qyrT rt7YVzkFB+hOLUSIJ+NeB/xTtTSDx+FIIWxzr00CwbV1FrRY4jeAXEUk/AzXg7GkgI 08n4dJUuyx6SAWTToA2wAVooQ593MUnZi/0K7dLOUlNiKcqNNAg75ourh/JpCJFrLp +yc+crit+o+Sf+HJDvn1e2H1G6wHifdqa+8tpNsxRgfzc1RN1UKLo808puEPioAioX NPztSZoqbtvUW3dldcn+sNC2XBg3bSl0LEW26DG8EFrFEVRQbGfFAMfrs6YPNC3ejp QV0sUm5WygvQw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vApVj-0000000FVlB-3hp4; Mon, 20 Oct 2025 13:01:16 +0000 Date: Mon, 20 Oct 2025 14:01:15 +0100 Message-ID: <86ms5lwwv8.wl-maz@kernel.org> From: Marc Zyngier To: Maximilian Dittgen Cc: , , , , , , , , , Subject: Re: [PATCH] KVM: selftests: fix ITS collection target addresses in vgic_lpi_stress In-Reply-To: <20251020121220.83972-1-mdittgen@amazon.de> References: <20251017161918.40711-1-mdittgen@amazon.de> <86v7kdwj8u.wl-maz@kernel.org> <20251020121220.83972-1-mdittgen@amazon.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: mdittgen@amazon.de, epetron@amazon.de, kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, mdittgen@amazon.com, nh-open-source@amazon.com, oliver.upton@linux.dev, pbonzini@redhat.com, shuah@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 20 Oct 2025 13:12:20 +0100, Maximilian Dittgen wrote: > > On Fri, 17 Oct 2025 19:06:25 +0200, > Marc Zyngier wrote: > > > > * We use linear CPU numbers for redistributor addressing, > > * so GITS_TYPER.PTA is 0. > > > > It is not an address. > > The issue is that its_encode_target in selftests is designed for > physical redistriubtor addresses (GITS_TYPER.PTA = 1) and thus No. Please read the spec. > performs a right shift by 16 bits: > > its_mask_encode(&cmd->raw_cmd[2], target_addr >> 16, 51, 16); > > When the vgic_lpi_stress selftest passes in a linear vCPU id as > the redistributor address (GITS_TYPER.PTA = 0 behavior), > The its_encode_target function shifts the CPU numbers 16 bits right, > functionally zeroing them. > > We need to either: > - Align this specific selftest with GITS_TYPER.PTA = 0 and not use > its_encode_target to encode the target vCPU id. Instead have a > dedicated encode function for the use case without a bit shift. > - Align all selftests with GITS_TYPER.PTA = 0 and refactor > its_encode_target to skip the bit shift altogether. > - Align selftests with GITS_TYPER.PTA = 1 and pass a redistributor > address, not a vCPU id, into its_send_mapc_cmd(). What part of "GITS_TYPER.PTA is 0" did you miss? > > Otherwise, the selftest's current behavior incorrectly maps all > collections to target vCPU 0. To be clear: I don't object to the patch. I object to the nonsensical commit message. You cannot say "I'm replacing the vcpu_id with an address". That's not for you to decide, as the emulated HW is *imposing* that decision on you. You don't even have the addresses at which the RDs are. You are merely *reformatting* the vcpu_id to fit a field that can *also* contain a 64kB-aligned address *when GITS_TYPER.PTA==1*. See 5.3.1 in the GICv3 spec. And yes, what you have is the correct fix. Just wrap it as a helper (I'd suggest procnum_to_rdbase(), if you need a name for it). This test also violate the architecture by not performing a SYNC after any command, which would also require the use of a properly formatted target field. But hey, correctness is overrated. Thanks, M. -- Without deviation from the norm, progress is not possible.