From patchwork Tue Dec 10 14:01:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 848743 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp334952wrn; Tue, 10 Dec 2024 06:02:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW4e7IRDEuDoRDAthNiO/VXIhoQu2QotyscSr7xR4mMpFMnQR4E9qVSdm6OnJ6H9bIllmCCSg==@linaro.org X-Google-Smtp-Source: AGHT+IH24HUmu5njaS7EADcElQdzkK77VAvnThGNasISxbszgAdTG5QfjQDXBJ5TuXprDbS0YIpJ X-Received: by 2002:a5d:64cb:0:b0:385:fd07:8616 with SMTP id ffacd0b85a97d-3864536c2f0mr3520774f8f.0.1733839354971; Tue, 10 Dec 2024 06:02:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733839354; cv=none; d=google.com; s=arc-20240605; b=K6gCa6GWs8ddkGPTHbmUeR0U8GK3zblIQ+GI5NBzBf9pgfmGmM1ixA+Ha+FQ49Cmvs kkDLHqdXI9d0un1HMc3DF1E5puF/dZEfWLiKUUeegMgeFdwQZ3joHFe/ypUveVEba7uk kyTaB3H4VKxyaXJfD8V6NKqXY+jm5sVG6QXesoR/5NNnS8YPbP4osyU8YeEQyK3HfgaP tnyKicZOaGXb/TnXDN0gbfbzfc+GZhasaAMSz8nCL4XqCjPG2XPW1zeVbcpsYCth23v1 V2gB7ToJjIp9spH3bBER3uzyrMt7XlWzS8W/AqmHx4ODtQhaTIhC88j9m4sQq5zre7ih IP4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RdRScNNnNoENuVLHw8PuiKPoBlDS12DHM2t0d0p1jZs=; fh=alZCUczDNtN4yFLy44SM1yTUliPrh8AgZa0GP8izqo4=; b=LPOkfToTIWGjAypoU2vbIym7obOogBF/uv/E8IEwA6itrw1XmSb6NKeNfeEC9oC4Ix nMWDFSy9O5ePOLNfNTiutu7WXU35mFUU4j8lhFiYIj7h+LGPsM8sWFdbQR4/Ji3+QNeD r5XbsAmKlxEp40I2xMUPgR7iHYl1r1Q0YQyoyJpzmBv6LNefDybEPn0heW+6fP0ol5Il 812Bhol7zlaHocF/iAbmltrX7PRV5I+8ZAShZ+D8RZwNtDeuTpjPniLwVO/lOLnGkfRV rArBwe50Cpe/kfgplOj6G4ocAenmwRejmMP/ul2kvJV3NuRu2dRfL9ubN6klskcgzkQl YS1g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z3eZGxZp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ffacd0b85a97d-3863741a36csi3447707f8f.521.2024.12.10.06.02.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 06:02:34 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z3eZGxZp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL0o9-0007D3-Aj; Tue, 10 Dec 2024 09:01:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tL0o0-0007Bh-3e for qemu-devel@nongnu.org; Tue, 10 Dec 2024 09:01:43 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL0ny-00073a-BU for qemu-devel@nongnu.org; Tue, 10 Dec 2024 09:01:39 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-38632b8ae71so2531827f8f.0 for ; Tue, 10 Dec 2024 06:01:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733839296; x=1734444096; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RdRScNNnNoENuVLHw8PuiKPoBlDS12DHM2t0d0p1jZs=; b=Z3eZGxZpugw7SAMgUYU4V6Grn7mvVijYGMqQw6ByET/josQva5VhI/yvF32yetDCq8 mHnHM2ApwdOVmZVRPLFLhEXyiXjx9sd20c/fBwyzuaUJgDvd2s0D88DC7Elct178Q7WJ DKRjpaGhXvPVMeWoBsVbJfchDaEs3oQ7tEqDQ0nDiWBg8sDc84cL7TLSZbSXM5H3F2ij QC9t21uYv8HHI82V+UReTUsR6fmCZrnyvXXFmlQsnb+EsUFi0Dlm7srObu8TktwRbpfe ikbpqvdiH9D/YpJhv6N5HnocxMyMixmU3d/Y3szehk2fo7WGwI7QA1VtdVCNGJQ5YhP3 0eaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733839296; x=1734444096; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RdRScNNnNoENuVLHw8PuiKPoBlDS12DHM2t0d0p1jZs=; b=MiIQs1DJwC4aPlBq64w8c1JIDDjfK5FuH3FwZxAbJk5JEK2EWiLVGkLeOvZsrAo3AL inmvgds/CO3Xf2vwq8cmAeOB2fRX0cSVhbpotBNOJ1i4fLuKya3EGt49oEc0/j+qQkDf aJx9h+frnctuS3ufUZwFilv1rmmuunxkrZVoP2HfGADJqwUAVhvMb/xzcdwwke7nibbh 6DAP3bjkkLXEw2UxZGXng2+BwiGSeqUk0beFnK1kPdYh1JNNN4ByiRoAPZe5Ush6CFSn xldEqEnO87a0acaRFgy9DSaFgUr2nNaZmJSjI+eQPjupJgXdT27jyKw5aPsSv01sIWhw rXcw== X-Gm-Message-State: AOJu0YwTMDMXeZxd9R62nQs1DxyGJUgNz/OFN/z3LfczxbhpKrzZ79hL e1cLCnzkdjq/H/Ty+AERrCWSguhCBB8dCMAQVGv4THa/C+iUeatLArxUk8g4lV1D3HnjRSCOMxQ wxBM= X-Gm-Gg: ASbGncul0R2dMqovUWLVD/Yw+zhvObDW6ZMJhkmv5kHENiEqeXrkmbtG2WoxFnU+165 LfuKMb4xhFqOZbQ7wnE0Sx3wW9BdG1VbTeB3S6tgLEKGOAK7Vhb3YbhYkYZg4kduvz5oa2aYat/ axiQqIA+OebdkdfaEt103TzVmAdAvAY1nskcgDBNdOCQX2oeXpX1HyMBe4loujqhsDbn64PCT9j utp//mq5KmVXhwRKaAvBx1yojH1v4s/CgQu9qd+ncYA72zJIZBrbvnodJBk37G9+kRVaSX6M7A5 QIaqwF6zYPJy97oNu6i0vuio X-Received: by 2002:a5d:588b:0:b0:386:3711:ff8c with SMTP id ffacd0b85a97d-386453def57mr3183190f8f.23.1733839295816; Tue, 10 Dec 2024 06:01:35 -0800 (PST) Received: from localhost.localdomain (223.132.22.93.rev.sfr.net. [93.22.132.223]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3862294b1e3sm15836567f8f.109.2024.12.10.06.01.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 10 Dec 2024 06:01:35 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= Subject: [PATCH v2 3/3] system: Remove mentions of cpu_physical_memory_rw() API Date: Tue, 10 Dec 2024 15:01:12 +0100 Message-ID: <20241210140112.43313-4-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210140112.43313-1-philmd@linaro.org> References: <20241210140112.43313-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.google.com 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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The previous commit mechanically replaced the legacy API calls by more recent ones. Finish the cleaning by manually removing the methods and the few mentions in the documentation. Signed-off-by: Philippe Mathieu-Daudé --- docs/devel/loads-stores.rst | 23 -------------------- scripts/coccinelle/exec_rw_const.cocci | 29 -------------------------- include/exec/cpu-common.h | 12 ----------- system/physmem.c | 7 ------- 4 files changed, 71 deletions(-) diff --git a/docs/devel/loads-stores.rst b/docs/devel/loads-stores.rst index 9471bac8599..37000393111 100644 --- a/docs/devel/loads-stores.rst +++ b/docs/devel/loads-stores.rst @@ -442,29 +442,6 @@ Regexes for git grep: - ``\`` - ``\`` -``cpu_physical_memory_*`` -~~~~~~~~~~~~~~~~~~~~~~~~~ - -These are convenience functions which are identical to -``address_space_*`` but operate specifically on the system address space, -always pass a ``MEMTXATTRS_UNSPECIFIED`` set of memory attributes and -ignore whether the memory transaction succeeded or failed. -For new code they are better avoided: - -* there is likely to be behaviour you need to model correctly for a - failed read or write operation -* a device should usually perform operations on its own AddressSpace - rather than using the system address space - -``cpu_physical_memory_read`` - -``cpu_physical_memory_write`` - -``cpu_physical_memory_rw`` - -Regexes for git grep: - - ``\`` - ``cpu_memory_rw_debug`` ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/scripts/coccinelle/exec_rw_const.cocci b/scripts/coccinelle/exec_rw_const.cocci index 1a202969519..3d94e1e8630 100644 --- a/scripts/coccinelle/exec_rw_const.cocci +++ b/scripts/coccinelle/exec_rw_const.cocci @@ -21,13 +21,6 @@ expression E1, E2, E3, E4, E5; + address_space_rw(E1, E2, E3, E4, E5, true) | -- cpu_physical_memory_rw(E1, E2, E3, 0) -+ cpu_physical_memory_rw(E1, E2, E3, false) -| -- cpu_physical_memory_rw(E1, E2, E3, 1) -+ cpu_physical_memory_rw(E1, E2, E3, true) -| - - cpu_physical_memory_map(E1, E2, 0) + cpu_physical_memory_map(E1, E2, false) | @@ -62,18 +55,6 @@ symbol true, false; + address_space_write(E1, E2, E3, E4, E5) ) -// Avoid uses of cpu_physical_memory_rw() with a constant is_write argument. -@@ -expression E1, E2, E3; -@@ -( -- cpu_physical_memory_rw(E1, E2, E3, false) -+ cpu_physical_memory_read(E1, E2, E3) -| -- cpu_physical_memory_rw(E1, E2, E3, true) -+ cpu_physical_memory_write(E1, E2, E3) -) - // Remove useless cast @@ expression E1, E2, E3, E4, E5, E6; @@ -93,16 +74,6 @@ type T; + address_space_write_rom(E1, E2, E3, E4, E5) | -- cpu_physical_memory_rw(E1, (T *)(E2), E3, E4) -+ cpu_physical_memory_rw(E1, E2, E3, E4) -| -- cpu_physical_memory_read(E1, (T *)(E2), E3) -+ cpu_physical_memory_read(E1, E2, E3) -| -- cpu_physical_memory_write(E1, (T *)(E2), E3) -+ cpu_physical_memory_write(E1, E2, E3) -| - - dma_memory_read(E1, E2, (T *)(E3), E4) + dma_memory_read(E1, E2, E3, E4) | diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 638dc806a5f..76906dfd189 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -140,18 +140,6 @@ void cpu_address_space_init(CPUState *cpu, int asidx, */ void cpu_address_space_destroy(CPUState *cpu, int asidx); -void cpu_physical_memory_rw(hwaddr addr, void *buf, - hwaddr len, bool is_write); -static inline void cpu_physical_memory_read(hwaddr addr, - void *buf, hwaddr len) -{ - cpu_physical_memory_rw(addr, buf, len, false); -} -static inline void cpu_physical_memory_write(hwaddr addr, - const void *buf, hwaddr len) -{ - cpu_physical_memory_rw(addr, (void *)buf, len, true); -} void *cpu_physical_memory_map(hwaddr addr, hwaddr *plen, bool is_write); diff --git a/system/physmem.c b/system/physmem.c index dc1db3a3846..be7816479f3 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -2999,13 +2999,6 @@ MemTxResult address_space_set(AddressSpace *as, hwaddr addr, return error; } -void cpu_physical_memory_rw(hwaddr addr, void *buf, - hwaddr len, bool is_write) -{ - address_space_rw(&address_space_memory, addr, MEMTXATTRS_UNSPECIFIED, - buf, len, is_write); -} - enum write_rom_type { WRITE_DATA, FLUSH_CACHE,