From nobody Wed Feb 11 04:06:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.45 as permitted sender) client-ip=209.85.128.45; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f45.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1621248752; cv=none; d=zohomail.com; s=zohoarc; b=T92x+pEnQV03O6uZs11aAStdCGkwP6yTafwc5ZBIIwrxRdtLRbW7/lXTAb+SXkA65w4A7x+lUYMsxKR8+icOMsIZuhn8r5vC0cZWN0X4E1B2wKzgwSXNUTeEXX/n8Z6W2vkgr2+jTAviPCJHnfziLFMBBZStZlxBJPtAtn401bQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621248752; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XUBQ2jpiST+SjMtXV19Tr50fj7IFpfqAc4jPduflUQA=; b=IfD3mLp7FBeUdnHUPzg+P1CN7J+5Tg9C1x8mPNZao8yWuvd05g8j4o2Dy9LPneuwJFhCdg8wJAJSFG5iygDO4bpZP9v7Ek1vcjvLdpGLoN4HgT/kuoFD/d672MlkljUgc0szJFZsQZbWSLlftPnxpwRx94QylPCpxR9ZJgzC7Rs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by mx.zohomail.com with SMTPS id 1621248752773552.2861194711008; Mon, 17 May 2021 03:52:32 -0700 (PDT) Received: by mail-wm1-f45.google.com with SMTP id z19-20020a7bc7d30000b029017521c1fb75so2713817wmk.0 for ; Mon, 17 May 2021 03:52:32 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (31.red-83-51-215.dynamicip.rima-tde.net. [83.51.215.31]) by smtp.gmail.com with ESMTPSA id s18sm6373966wra.80.2021.05.17.03.52.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 03:52:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XUBQ2jpiST+SjMtXV19Tr50fj7IFpfqAc4jPduflUQA=; b=nWQ7/CEDtfWl1LXldVPc9K5bALGvFIUBV6ph6/N8+ChrQW23KFZp5MpgMQLYwj5Tgz xisu6owmQlGD3f5LKGqNpPUpQCH0/UcmkyriF/I9yAMLgOKbhJxeGz5AXUzZn2c+YyTO uzJFIVk+EkNUdQB6T7YsRZjrs4VhABYwv89ZQlrocLX2R4IXRBUv0YwpXMgmNnYAHJ59 n5Oa4ACmY7PG9NPs+r34M3lPgUXekl14gSB2IyaeYkmw7Iq0gFYZW0ZKEHEPfO+liGjz BTpNraEeGM7OwJJn9OxNOncY9tQjHORKWtPn+8vKmcIviFICatTMUoMvoDB0/0Jr/hpD 8G2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=XUBQ2jpiST+SjMtXV19Tr50fj7IFpfqAc4jPduflUQA=; b=JCLmCmULpb5UyofQzaSkmksBupSpvNd6j15y3YS8EnG76q2bSBedPUuI2cqyU1/mBA 9D6T5yJ6TI5vKwaAiqx0gMIrnVq0aevpJXZcddjAI3yX6Zfnn+rQ6wSN4ifLxFuGdPQG txXXXikOHLFZ81Oqc7EiIocrzuKFshmnO7ugX08jKGAsUqnPFp2wue05jV/VHPd1A593 T2n5uhW4YCCaWFLyt+KLQZW7KNL7ntjzt3ECB8nGu4nonMc2QFl+58cHsMD/Izl6pVjS iz3tO55HaVW0RIKX948mC6jJYQLryRqJV9mZ2nB3mzfDyq2gr+5thU+bDvYJlp3WQnT3 /Fjg== X-Gm-Message-State: AOAM5311zc3ozAQIdeSTzZGQk1Pc708OAalzUC1mddX14XUlnaIs5I3W aycVdU9eOx5aHOQw2wKV0EM= X-Google-Smtp-Source: ABdhPJzIkw5diq4X5Z2elTFmNxSCJz+e8KNJZlWO7KlXhKmhaz5YLGhd1xq1Ffj6YkNca7lf/DxgQQ== X-Received: by 2002:a1c:4043:: with SMTP id n64mr19203312wma.9.1621248751005; Mon, 17 May 2021 03:52:31 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Richard Henderson , qemu-arm@nongnu.org, Laurent Vivier , Paolo Bonzini , qemu-riscv@nongnu.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v7 10/23] cpu: Directly use get_memory_mapping() fallback handlers in place Date: Mon, 17 May 2021 12:51:27 +0200 Message-Id: <20210517105140.1062037-11-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210517105140.1062037-1-f4bug@amsat.org> References: <20210517105140.1062037-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) No code uses CPUClass::get_memory_mapping() outside of hw/core/cpu.c: $ git grep -F -- '->get_memory_mapping' hw/core/cpu.c:87: cc->get_memory_mapping(cpu, list, errp); hw/core/cpu.c:439: k->get_memory_mapping =3D cpu_common_get_memory_map= ping; target/i386/cpu.c:7422: cc->get_memory_mapping =3D x86_cpu_get_memory_= mapping; Check the handler presence in place and remove the common fallback code. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/cpu-common.c | 16 ---------------- hw/core/cpu-sysemu.c | 13 +++++++++++++ 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 2aa6b8cffca..9530e266ecb 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -66,21 +66,6 @@ CPUState *cpu_create(const char *typename) return cpu; } =20 -void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list, - Error **errp) -{ - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - cc->get_memory_mapping(cpu, list, errp); -} - -static void cpu_common_get_memory_mapping(CPUState *cpu, - MemoryMappingList *list, - Error **errp) -{ - error_setg(errp, "Obtaining memory mappings is unsupported on this CPU= ."); -} - /* Resetting the IRQ comes from across the code base so we take the * BQL here if we need to. cpu_interrupt assumes it is held.*/ void cpu_reset_interrupt(CPUState *cpu, int mask) @@ -304,7 +289,6 @@ static void cpu_class_init(ObjectClass *klass, void *da= ta) k->parse_features =3D cpu_common_parse_features; k->get_arch_id =3D cpu_common_get_arch_id; k->has_work =3D cpu_common_has_work; - k->get_memory_mapping =3D cpu_common_get_memory_mapping; k->gdb_read_register =3D cpu_common_gdb_read_register; k->gdb_write_register =3D cpu_common_gdb_write_register; set_bit(DEVICE_CATEGORY_CPU, dc->categories); diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c index 931ba46354d..aa68ca281e8 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -33,6 +33,19 @@ bool cpu_paging_enabled(const CPUState *cpu) return false; } =20 +void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list, + Error **errp) +{ + CPUClass *cc =3D CPU_GET_CLASS(cpu); + + if (cc->get_memory_mapping) { + cc->get_memory_mapping(cpu, list, errp); + return; + } + + error_setg(errp, "Obtaining memory mappings is unsupported on this CPU= ."); +} + hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, MemTxAttrs *attrs) { --=20 2.26.3