From nobody Mon Dec 09 21:55:54 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y6bK65wxfz5grM3; Mon, 09 Dec 2024 21:55:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y6bK6531tz4KDp; Mon, 9 Dec 2024 21:55:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733781354; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ePwT8idOdhPr9Sa/ngTU61wUWB8djTIRu4hbX6MKS/c=; b=VdiJomIZx/cA/FsKRugpoeRKZRGyT/Zdx0Ds33qvgKHav51yZGDyIfTYk7CT36JCqs7x78 FZsw/d7Ss/qzTFe2nhCcW0P77XgxFd9sjSrd959SDu7BHTXzNd/G1lyk1t3UCh3mEz4C88 vYOFS/G1bxKN2JzFxhV6cl8EyBxQ3Wp2CTWB0SZj5IDeBiQExUHJOB71bGzQ0QtUVzEXE8 XRZ/9s1CiS4QU8r58mbI9vT/LrJrtnU46H3aLvwq4ha9wLQ6ArrwFq0HiLt/OQcjG8l4n6 eruuOL+aVnyrrkwTw3nsJx9XFEmCFXYfAbAbLiCsZKSlApuTMgfgI7B/rRGyeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733781354; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ePwT8idOdhPr9Sa/ngTU61wUWB8djTIRu4hbX6MKS/c=; b=NiB8VNNMmlgxVgCl7FZXE6jxYvt8Ecj9wk6fwyMCPhRKMwPm2Lq7xrwHhAvwqqpHF6Zm3W paq7GIOPYuF8EX3MgrXdezb2Rxzb/oxRQ+PcWWkJJZgSvkv6hSAIluCXtm5BUnZ+FeJWCC yo8BedZZbHsc9b088k1uiGG1aBaO7293smkpGK2nto2W26JVI7IMV6Fq56inPbKjJjDnMs kalB5bZcazYz0WIG4PSkqNZKItBaN7HTgXreZdn9VkOR7BI8fFVCzhI4ScJNiGajItt4xt pxROuUdyMtL81gCdJ1u166PtovFwIDEDW7U1+tI8yb9aYCYMDVZo3iaOeY5lEA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733781354; a=rsa-sha256; cv=none; b=Hkg8CU0xg8GyueXO/XshBvP5q6H7o9O9eR/Ncs7pmI44KW7FvG0GT0HIi0SaiolsaNzOGD Wx7WmRjI/ngjWQHkdLABpBSi+sIIiaroCekqBhF9zGMSNvr14Mi9oMLSpgtFT8gIHFZumh OZKhmoPopy2VNEuj35w8RQzf7G92Q6mUxpxal9lovFPJoK2jKvwiD048VBWxAjQ6INo43S aDGwhmGLx39bxh9MU1cbhFSfXcaxZjzBXIpngFVnI/L8UDDldfgypwokvlGOGwydPNxmia 5S/Q+Skbz38Jj3Tm9mi85kn9efFuymoPL36SeQVjZh1Mv+9399+T4TrfwArt0g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y6bK63xpDzvVv; Mon, 9 Dec 2024 21:55:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B9Ltsu6052214; Mon, 9 Dec 2024 21:55:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B9Ltscn052211; Mon, 9 Dec 2024 21:55:54 GMT (envelope-from git) Date: Mon, 9 Dec 2024 21:55:54 GMT Message-Id: <202412092155.4B9Ltscn052211@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: f8c90b704189 - main - gic_v3: Correctly handle GICC GIGR Base Address case List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f8c90b704189c94275d22d7cc204d1d74e821d86 Auto-Submitted: auto-generated The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=f8c90b704189c94275d22d7cc204d1d74e821d86 commit f8c90b704189c94275d22d7cc204d1d74e821d86 Author: Jessica Clarke AuthorDate: 2024-12-09 21:55:06 +0000 Commit: Jessica Clarke CommitDate: 2024-12-09 21:55:06 +0000 gic_v3: Correctly handle GICC GIGR Base Address case When using the GICR Base Address field from each GICC structure instead of GICR structures, the field gives the address of a single redistributor page. However, that does not mean that they are not contiguous, and so GICR_TYPER.Last could be clear on them. Thus we must ignore GICR_TYPER.Last in this case and always treat each region as having a single page. Normally we'd do that as a result of checking against the rman's size (though that's a rather roundabout and iffy way of achieving it), but for whatever reason this is bigger on the Qualcomm Snapdragon X Elite (I assume the MADT reports GICv4 but TYPER doesn't report VLPIS and so there is a mismatch between the rman size and the stride used) and we end up walking off the region's mapping. Reviewed by: andrew, phk MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47560 --- sys/arm64/arm64/gic_v3.c | 2 +- sys/arm64/arm64/gic_v3_acpi.c | 1 + sys/arm64/arm64/gic_v3_var.h | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/gic_v3.c b/sys/arm64/arm64/gic_v3.c index 964a129111e2..201cdae6de09 100644 --- a/sys/arm64/arm64/gic_v3.c +++ b/sys/arm64/arm64/gic_v3.c @@ -1434,7 +1434,7 @@ gic_v3_redist_find(struct gic_v3_softc *sc) (GICR_VLPI_BASE_SIZE + GICR_RESERVED_SIZE); } } while (offset < rman_get_size(r_res) && - (typer & GICR_TYPER_LAST) == 0); + !sc->gic_redists.single && (typer & GICR_TYPER_LAST) == 0); } device_printf(sc->dev, "No Re-Distributor found for CPU%u\n", cpuid); diff --git a/sys/arm64/arm64/gic_v3_acpi.c b/sys/arm64/arm64/gic_v3_acpi.c index 44c55cf5bbf2..7c3495fd442b 100644 --- a/sys/arm64/arm64/gic_v3_acpi.c +++ b/sys/arm64/arm64/gic_v3_acpi.c @@ -300,6 +300,7 @@ gic_v3_acpi_count_regions(device_t dev) acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length, madt_count_gicc_redistrib, sc); + sc->gic_redists.single = true; } acpi_unmap_table(madt); diff --git a/sys/arm64/arm64/gic_v3_var.h b/sys/arm64/arm64/gic_v3_var.h index 1c5d354ee217..8bc0f456d91e 100644 --- a/sys/arm64/arm64/gic_v3_var.h +++ b/sys/arm64/arm64/gic_v3_var.h @@ -53,6 +53,12 @@ struct gic_redists { struct resource ** regions; /* Number of Re-Distributor regions */ u_int nregions; + /* + * Whether to treat each region as a single Re-Distributor page or a + * series of contiguous pages (i.e. from each ACPI MADT GICC's GICR + * Base Address field) + */ + bool single; /* Per-CPU Re-Distributor data */ struct redist_pcpu *pcpu; };