Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2196942/?format=api
{ "id": 2196942, "url": "http://patchwork.ozlabs.org/api/patches/2196942/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260216-phys_addr-v5-5-29d522f1339c@rev.ng/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260216-phys_addr-v5-5-29d522f1339c@rev.ng>", "list_archive_url": null, "date": "2026-02-16T16:28:42", "name": "[v5,5/7] hw/loongarch: Use loongarch_palen_mask()", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "f4dd5857a7127253b495c6f19fbde61825b2dc89", "submitter": { "id": 92408, "url": "http://patchwork.ozlabs.org/api/people/92408/?format=api", "name": "Anton Johansson", "email": "anjo@rev.ng" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260216-phys_addr-v5-5-29d522f1339c@rev.ng/mbox/", "series": [ { "id": 492329, "url": "http://patchwork.ozlabs.org/api/series/492329/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=492329", "date": "2026-02-16T16:28:43", "name": "[v5,1/7] target/hppa: Define PA[20|1X] physical address space size", "version": 5, "mbox": "http://patchwork.ozlabs.org/series/492329/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2196942/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2196942/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=rev.ng header.i=@rev.ng header.a=rsa-sha256\n header.s=dkim header.b=CZfc6LSH;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fF7S63nBjz1xyC\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 17 Feb 2026 03:25:57 +1100 (AEDT)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1vs1Pg-00005h-Ca; Mon, 16 Feb 2026 11:25:32 -0500", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <anjo@rev.ng>) id 1vs1Pe-000055-8L\n for qemu-devel@nongnu.org; Mon, 16 Feb 2026 11:25:30 -0500", "from rev.ng ([94.130.142.21])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <anjo@rev.ng>) id 1vs1Pa-0002tx-3w\n for qemu-devel@nongnu.org; Mon, 16 Feb 2026 11:25:28 -0500" ], "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=rev.ng;\n s=dkim; h=Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding:\n Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Content-ID:\n Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:\n List-Post:List-Owner:List-Archive:List-Unsubscribe:List-Unsubscribe-Post:\n List-Help; bh=4LkiTaljfkOqrefowX7cdd5uer+Jd06QUXUJdOltMMk=; b=CZfc6LSHGF63IGf\n luLxOOiwMWD1GlizhU7OqvZt6sZ36R9d42njIkdcwYnNGasLV8Ukr4+bOj0mPdHO89FCuC9EsLnJt\n PaSYPd+88rbvyQXY9TPDopvPx1YWFqBcOULO8MG5Xtc9EQbAsvc5dbm8f0u8lnqCHklHYUxqTYn/M\n /Q=;", "Date": "Mon, 16 Feb 2026 17:28:42 +0100", "Subject": "[PATCH v5 5/7] hw/loongarch: Use loongarch_palen_mask()", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20260216-phys_addr-v5-5-29d522f1339c@rev.ng>", "References": "<20260216-phys_addr-v5-0-29d522f1339c@rev.ng>", "In-Reply-To": "<20260216-phys_addr-v5-0-29d522f1339c@rev.ng>", "To": "qemu-devel@nongnu.org", "Cc": "=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>,\n Richard Henderson <richard.henderson@linaro.org>,\n Helge Deller <deller@gmx.de>, Paolo Bonzini <pbonzini@redhat.com>,\n Song Gao <gaosong@loongson.cn>, Bibo Mao <maobibo@loongson.cn>,\n Palmer Dabbelt <palmer@dabbelt.com>,\n Alistair Francis <alistair.francis@wdc.com>,\n Brian Cain <brian.cain@oss.qualcomm.com>,\n Chao Liu <chao.liu.zevorn@gmail.com>, Anton Johansson <anjo@rev.ng>", "X-Developer-Signature": "v=1; a=ed25519-sha256; t=1771259334; l=6394;\n i=anjo@rev.ng; s=20260210; h=from:subject:message-id;\n bh=5MbRiX/4ApGQhlJ/njDl1vuK2WFfFk2T7B57kDt5a54=;\n b=WeQMQNQ8+AcyBkzmRZEOj1+cSnOmwyxzvuseV+GkTu6htuNFyWaC9JYkb6OkvE/+//I6fcJTy\n gtNlVNHyaIJA6wvXt9MzQdaeR5CrdjA8cmfg/LVJhTzeHqfJkMdZsKp", "X-Developer-Key": "i=anjo@rev.ng; a=ed25519;\n pk=dKsZvj/g3kgDxnV1/SWg8a0YNGSpWtFGNsWIepQYKow=", "Received-SPF": "pass client-ip=94.130.142.21; envelope-from=anjo@rev.ng;\n helo=rev.ng", "X-Spam_score_int": "-20", "X-Spam_score": "-2.1", "X-Spam_bar": "--", "X-Spam_report": "(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Reply-to": "Anton Johansson <anjo@rev.ng>", "From": "Anton Johansson via qemu development <qemu-devel@nongnu.org>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "Replaces remaining uses of TARGET_PHYS_ADDR_SPACE_BITS with\nruntime calls to loongarch_palen_mask() to fetch the physical\naddress mask from the cpucfg PALEN field.\n\nReviewed-by: Richard Henderson <richard.henderson@linaro.org>\nSigned-off-by: Anton Johansson <anjo@rev.ng>\n---\n include/hw/loongarch/boot.h | 3 ++-\n hw/loongarch/boot.c | 28 ++++++++++++++++------------\n hw/loongarch/virt.c | 5 ++++-\n 3 files changed, 22 insertions(+), 14 deletions(-)", "diff": "diff --git a/include/hw/loongarch/boot.h b/include/hw/loongarch/boot.h\nindex 9819f7fbe3..4984322f75 100644\n--- a/include/hw/loongarch/boot.h\n+++ b/include/hw/loongarch/boot.h\n@@ -113,6 +113,7 @@ struct memmap_entry {\n uint32_t reserved;\n };\n \n-void loongarch_load_kernel(MachineState *ms, struct loongarch_boot_info *info);\n+void loongarch_load_kernel(MachineState *ms, struct loongarch_boot_info *info,\n+ uint64_t phys_addr_mask);\n \n #endif /* HW_LOONGARCH_BOOT_H */\ndiff --git a/hw/loongarch/boot.c b/hw/loongarch/boot.c\nindex 711d5ffbbc..ef8eae237c 100644\n--- a/hw/loongarch/boot.c\n+++ b/hw/loongarch/boot.c\n@@ -217,10 +217,12 @@ static void init_cmdline(struct loongarch_boot_info *info, void *p, void *start)\n \n static uint64_t cpu_loongarch_virt_to_phys(void *opaque, uint64_t addr)\n {\n- return addr & MAKE_64BIT_MASK(0, TARGET_PHYS_ADDR_SPACE_BITS);\n+ uint64_t *phys_addr_mask = opaque;\n+ return addr & *phys_addr_mask;\n }\n \n static int64_t load_loongarch_linux_image(const char *filename,\n+ uint64_t phys_addr_mask,\n uint64_t *kernel_entry,\n uint64_t *kernel_low,\n uint64_t *kernel_high)\n@@ -251,10 +253,8 @@ static int64_t load_loongarch_linux_image(const char *filename,\n }\n \n /* Early kernel versions may have those fields in virtual address */\n- *kernel_entry = extract64(le64_to_cpu(hdr->kernel_entry),\n- 0, TARGET_PHYS_ADDR_SPACE_BITS);\n- *kernel_low = extract64(le64_to_cpu(hdr->load_offset),\n- 0, TARGET_PHYS_ADDR_SPACE_BITS);\n+ *kernel_entry = le64_to_cpu(hdr->kernel_entry) & phys_addr_mask;\n+ *kernel_low = le64_to_cpu(hdr->load_offset) & phys_addr_mask;\n *kernel_high = *kernel_low + size;\n \n rom_add_blob_fixed(filename, buffer, size, *kernel_low);\n@@ -303,19 +303,21 @@ static ram_addr_t alloc_initrd_memory(struct loongarch_boot_info *info,\n exit(1);\n }\n \n-static int64_t load_kernel_info(struct loongarch_boot_info *info)\n+static int64_t load_kernel_info(struct loongarch_boot_info *info,\n+ uint64_t phys_addr_mask)\n {\n uint64_t kernel_entry, kernel_low, kernel_high, initrd_offset = 0;\n ssize_t kernel_size;\n \n kernel_size = load_elf(info->kernel_filename, NULL,\n- cpu_loongarch_virt_to_phys, NULL,\n+ cpu_loongarch_virt_to_phys, &phys_addr_mask,\n &kernel_entry, &kernel_low,\n &kernel_high, NULL, ELFDATA2LSB,\n EM_LOONGARCH, 1, 0);\n- kernel_entry = cpu_loongarch_virt_to_phys(NULL, kernel_entry);\n+ kernel_entry = cpu_loongarch_virt_to_phys(&phys_addr_mask, kernel_entry);\n if (kernel_size < 0) {\n kernel_size = load_loongarch_linux_image(info->kernel_filename,\n+ phys_addr_mask,\n &kernel_entry, &kernel_low,\n &kernel_high);\n }\n@@ -395,14 +397,15 @@ static void init_boot_rom(MachineState *ms,\n }\n \n static void loongarch_direct_kernel_boot(MachineState *ms,\n- struct loongarch_boot_info *info)\n+ struct loongarch_boot_info *info,\n+ uint64_t phys_addr_mask)\n {\n void *p, *bp;\n int64_t kernel_addr = VIRT_FLASH0_BASE;\n uint64_t *data;\n \n if (info->kernel_filename) {\n- kernel_addr = load_kernel_info(info);\n+ kernel_addr = load_kernel_info(info, phys_addr_mask);\n } else {\n if (!qtest_enabled()) {\n warn_report(\"No kernel provided, booting from flash drive.\");\n@@ -429,7 +432,8 @@ static void loongarch_direct_kernel_boot(MachineState *ms,\n g_free(bp);\n }\n \n-void loongarch_load_kernel(MachineState *ms, struct loongarch_boot_info *info)\n+void loongarch_load_kernel(MachineState *ms, struct loongarch_boot_info *info,\n+ uint64_t phys_addr_mask)\n {\n LoongArchVirtMachineState *lvms = LOONGARCH_VIRT_MACHINE(ms);\n \n@@ -440,6 +444,6 @@ void loongarch_load_kernel(MachineState *ms, struct loongarch_boot_info *info)\n if (lvms->bios_loaded) {\n loongarch_firmware_boot(lvms, info);\n } else {\n- loongarch_direct_kernel_boot(ms, info);\n+ loongarch_direct_kernel_boot(ms, info, phys_addr_mask);\n }\n }\ndiff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c\nindex a75968e4c9..9e26c25c23 100644\n--- a/hw/loongarch/virt.c\n+++ b/hw/loongarch/virt.c\n@@ -34,6 +34,7 @@\n #include \"hw/misc/unimp.h\"\n #include \"hw/loongarch/fw_cfg.h\"\n #include \"target/loongarch/cpu.h\"\n+#include \"target/loongarch/cpu-mmu.h\"\n #include \"hw/firmware/smbios.h\"\n #include \"qapi/qapi-visit-common.h\"\n #include \"hw/acpi/generic_event_device.h\"\n@@ -928,6 +929,7 @@ static void virt_init(MachineState *machine)\n hwaddr base, size, ram_size = machine->ram_size;\n MachineClass *mc = MACHINE_GET_CLASS(machine);\n Object *cpuobj;\n+ uint64_t phys_addr_mask = 0;\n \n if (!cpu_model) {\n cpu_model = LOONGARCH_CPU_TYPE_NAME(\"la464\");\n@@ -1017,7 +1019,8 @@ static void virt_init(MachineState *machine)\n qemu_register_powerdown_notifier(&lvms->powerdown_notifier);\n \n lvms->bootinfo.ram_size = ram_size;\n- loongarch_load_kernel(machine, &lvms->bootinfo);\n+ phys_addr_mask = loongarch_palen_mask(&LOONGARCH_CPU(first_cpu)->env);\n+ loongarch_load_kernel(machine, &lvms->bootinfo, phys_addr_mask);\n }\n \n static void virt_get_acpi(Object *obj, Visitor *v, const char *name,\n", "prefixes": [ "v5", "5/7" ] }