From patchwork Wed May 26 23:46:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448337 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp14631jac; Wed, 26 May 2021 16:56:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2dV2Jn++dvPVAaEg2A2RkHiOyTbFZ4eaoQ2qStY8pUgoJSj2IytWI+6nHNut7dJeQPVEC X-Received: by 2002:a37:7ac5:: with SMTP id v188mr673910qkc.193.1622073396885; Wed, 26 May 2021 16:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073396; cv=none; d=google.com; s=arc-20160816; b=E/Hqma13Lu0xEhHjPLzEcClGbst3OpmKXKhg4Ud4Cr13e45Lrop6xMAKTgbysWP05l 84fx5B550b55yPk8fch6B6tt2GfZWI0W4aygkV17BIAqtaQq2EyRaLUZhj2LydJs7Lza Wk4qUL9Qubw0md235ycP/vWgkg5A2nHHVPnxjNFyPgOIwoaUkP1ckbL9kC9xiFVLEeKE tK/UZituagwfRrtM0VkbZzSxjivoD/ymjJ3q9FaEMBUHtJFsQv1v+I6S2DdgwhhEmmwT WerPyTBT075h7zj1pEhLtN5gzN5hdcPLlyJJW9kVGdkMUWMyhXJmWVijuFM32xcTSg0M Se/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=35fS2mEHUPwPaI8xH8/39rsUu1yuwzdz1o4w+eONAWI=; b=kFy9cAl+tAkINU6tMNvn9ao6BNo8GS0bCXhWtjs9ocC8L0QlouykuwGgFXCAOTSYUB 2AlkpMeVWd+TJk6ICSGEdrE0aGh4hK6p5c9P3/v4vjmtII94shTDABRPq0L1KJXXXrJH CHevvbpouc1yxKdlMQnWh6dDptXrAnaqY5Q/KVCSL7WgA0uczErIFMe8ecOjdsFr1MaG Lq78e7AUKksmzYbGFmmWjfIYZ03flSL7GEo/D8tO4SNiRo/aCeJ8a7OAEPWlUKwjgMDE y2FgnkzlFhwEP5W1jgywfXesM1YM1elGuPu/hF1K3yG6F/zNgB5IcQq2p8pU+z/VSI/8 lfjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D+smDHfv; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a9si459255qto.11.2021.05.26.16.56.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 16:56:36 -0700 (PDT) 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=D+smDHfv; 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 Received: from localhost ([::1]:52762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3O8-0006Vq-9q for patch@linaro.org; Wed, 26 May 2021 19:56:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FI-0005c2-Ku for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:29 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:39662) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3F7-0004RH-4Z for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:28 -0400 Received: by mail-pj1-x1032.google.com with SMTP id o17-20020a17090a9f91b029015cef5b3c50so1243666pjp.4 for ; Wed, 26 May 2021 16:47:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=35fS2mEHUPwPaI8xH8/39rsUu1yuwzdz1o4w+eONAWI=; b=D+smDHfv1TjQyqs99zdornvb4hN7tGtGRI4F00mDXTi3DNwQlEUYv5ys6mmSrdsadL nd6xjlQ3dP/VSLLHA7QdqNJzjQv1UD5EqFEnHHbKifofTNWJLBUDMvO5bTNP5biBtUeU NITwalGZeCzl4jKmSMz4OmXZyVXZX/Mbwbv6ZobirxBt3Y9enPNVfKQaFIfAtoAf3ZPP HvFYP7QwENIJMm2FgSj/kdwOC/24yLhoNqfo0KRmLRHXp2JhmU/LnCycBqJ1XwtZkD48 OZlmcoZIegaB1JO3VjLPenKWZdR9B9ny3GXmkTP/yAxYl7MfOcRz018jWLfL2KZzAchQ P/Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=35fS2mEHUPwPaI8xH8/39rsUu1yuwzdz1o4w+eONAWI=; b=V98ub+IL1zDXcKd+5aOghUH6Yneo4AP5Gu0w+BAgNwssMTzOiM32hHhMY/iYqv012c t+jXTfe0STogsn3O5PsONvoIxagNT/Nqe/qsNjiqqSJT09mfU6wLrAWdiLu/ShX86jbH dIBl7sW5YvH8NltQdtMOm5JMfApUwYxsiwI0mQtEDureGYJ4uyhsELNuks//4skpGrLd DpOr8bScgrwd/AJE4ak5YBiTbSGmr+VhJ6drytjsROUh5rXPOFQMON8nZSfky31CNRki gb6xzHwzkjTg7ewdZCz0v8DVm4lfwCv/mIQNvvY1tLNnXIdYh9n9tfS32qO83fc/BrBJ fobw== X-Gm-Message-State: AOAM533BOqUAdEYI5AjA+Pv9Hw1CHuCFFk2hpbwA5stA7u5K9mWwQPIS wOxSuBExBT3tZ47mHd1hxJMGVKYaS5lYjw== X-Received: by 2002:a17:903:230b:b029:f4:b7cf:44aa with SMTP id d11-20020a170903230bb02900f4b7cf44aamr592078plh.31.1622072834302; Wed, 26 May 2021 16:47:14 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 01/31] exec/memory_ldst_cached: Sort declarations Date: Wed, 26 May 2021 16:46:40 -0700 Message-Id: <20210526234710.125396-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé To ease the file review, sort the declarations by the size of the access (8, 16, 32). Simple code movement, no logical change. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210518183655.1711377-2-philmd@redhat.com> Signed-off-by: Richard Henderson --- include/exec/memory_ldst_cached.h.inc | 46 +++++++++++++-------------- 1 file changed, 23 insertions(+), 23 deletions(-) -- 2.25.1 diff --git a/include/exec/memory_ldst_cached.h.inc b/include/exec/memory_ldst_cached.h.inc index 7bc8790d34..c33449d0cd 100644 --- a/include/exec/memory_ldst_cached.h.inc +++ b/include/exec/memory_ldst_cached.h.inc @@ -24,6 +24,18 @@ #define LD_P(size) \ glue(glue(ld, size), glue(ENDIANNESS, _p)) +static inline uint32_t ADDRESS_SPACE_LD_CACHED(uw)(MemoryRegionCache *cache, + hwaddr addr, MemTxAttrs attrs, MemTxResult *result) +{ + assert(addr < cache->len && 2 <= cache->len - addr); + fuzz_dma_read_cb(cache->xlat + addr, 2, cache->mrs.mr); + if (likely(cache->ptr)) { + return LD_P(uw)(cache->ptr + addr); + } else { + return ADDRESS_SPACE_LD_CACHED_SLOW(uw)(cache, addr, attrs, result); + } +} + static inline uint32_t ADDRESS_SPACE_LD_CACHED(l)(MemoryRegionCache *cache, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) { @@ -48,18 +60,6 @@ static inline uint64_t ADDRESS_SPACE_LD_CACHED(q)(MemoryRegionCache *cache, } } -static inline uint32_t ADDRESS_SPACE_LD_CACHED(uw)(MemoryRegionCache *cache, - hwaddr addr, MemTxAttrs attrs, MemTxResult *result) -{ - assert(addr < cache->len && 2 <= cache->len - addr); - fuzz_dma_read_cb(cache->xlat + addr, 2, cache->mrs.mr); - if (likely(cache->ptr)) { - return LD_P(uw)(cache->ptr + addr); - } else { - return ADDRESS_SPACE_LD_CACHED_SLOW(uw)(cache, addr, attrs, result); - } -} - #undef ADDRESS_SPACE_LD_CACHED #undef ADDRESS_SPACE_LD_CACHED_SLOW #undef LD_P @@ -71,17 +71,6 @@ static inline uint32_t ADDRESS_SPACE_LD_CACHED(uw)(MemoryRegionCache *cache, #define ST_P(size) \ glue(glue(st, size), glue(ENDIANNESS, _p)) -static inline void ADDRESS_SPACE_ST_CACHED(l)(MemoryRegionCache *cache, - hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) -{ - assert(addr < cache->len && 4 <= cache->len - addr); - if (likely(cache->ptr)) { - ST_P(l)(cache->ptr + addr, val); - } else { - ADDRESS_SPACE_ST_CACHED_SLOW(l)(cache, addr, val, attrs, result); - } -} - static inline void ADDRESS_SPACE_ST_CACHED(w)(MemoryRegionCache *cache, hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) { @@ -93,6 +82,17 @@ static inline void ADDRESS_SPACE_ST_CACHED(w)(MemoryRegionCache *cache, } } +static inline void ADDRESS_SPACE_ST_CACHED(l)(MemoryRegionCache *cache, + hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) +{ + assert(addr < cache->len && 4 <= cache->len - addr); + if (likely(cache->ptr)) { + ST_P(l)(cache->ptr + addr, val); + } else { + ADDRESS_SPACE_ST_CACHED_SLOW(l)(cache, addr, val, attrs, result); + } +} + static inline void ADDRESS_SPACE_ST_CACHED(q)(MemoryRegionCache *cache, hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result) { From patchwork Wed May 26 23:46:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448235 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2b0d:0:0:0:0 with SMTP id gc13csp6044478ejc; Wed, 26 May 2021 16:49:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6AJ4G4KSd50KMxIVXQhEUMP+iFtitktLjdPay1iAYmm6KqRB+m3Yx392+DXijgDrlbMme X-Received: by 2002:a25:f50b:: with SMTP id a11mr776799ybe.181.1622072994703; Wed, 26 May 2021 16:49:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622072994; cv=none; d=google.com; s=arc-20160816; b=gtMeNWbHd6llBbP2udVAuTbCwBh479cHE1ih9k7SK79lQc95eWiUhUQoWhimd7Vuh2 xHr/to3oy/CL1P2e+IfQucFF/JioVSII9Oh2cnBkw/gMv/UDGWzu7NnA2+mnbl37h9Mh 5al2OsaFmJQ97eeMjkB4xGis95JtH1Xhbsd+EW7opsrPsoDz5ucRo0a73aPVI6ggp3yK SPRSEvkFmZXDgNjnlLA639Xnul0Ye7Dk7EsnGxscXXi8KRXZs8OoVSVWkkSv9RMx0Vsw zh6dP6l+WpfqtT5TZFrzEWrY6MgObCMcdiJYHiY0jFtonY3ErUYWoD/iT4o9KW16b3Mx xH5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=AL54ucl9rKZtOi9n7cxYrp3sXcKmYEJsp/xosYfzNek=; b=XRmcfz39sRof/rZOLhz1zuaW+FEjYlw08QR1HjmLG/MOfZz1asgnfbEl32RO2UJGLD eS+ZJApKk38uLo5vpO7YTfhEszsxSkypKusn3JgxqRpgD/BE7cakbSUqHlcf2VHC3Tie 811NTmk7Us/K2VvXkemPqqTmB+8ueIuwPA6v37sxUAudAxzfuRgDdGl+2ZFcQvJC2l8C mzj9RevS3WVXhPV2ayoUF/E1T0/YS/9MyKUtDXN64ORRb10gSgJixvGWYeiiQFSmjJTx VdixdW+/UJDbObCc4HUy7V0W5mB+Z/H12zNQkPG73tv6+hgLafn0R6q6F2Xrncomgb7h jPxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tsmhNVVT; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t13si552893ybu.481.2021.05.26.16.49.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 16:49:54 -0700 (PDT) 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=tsmhNVVT; 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 Received: from localhost ([::1]:60600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3Hd-0000m1-VP for patch@linaro.org; Wed, 26 May 2021 19:49:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FH-0005bh-VC for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:27 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:33701) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3F7-0004Rt-26 for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:27 -0400 Received: by mail-pg1-x536.google.com with SMTP id i5so2333356pgm.0 for ; Wed, 26 May 2021 16:47:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AL54ucl9rKZtOi9n7cxYrp3sXcKmYEJsp/xosYfzNek=; b=tsmhNVVT5upgP/qFpjXyY6gr7iumkFodLHoPiL/isYWN++DI90zo4FNYaSRe1hx7IL n9PnE4xKKrQ6Rw+B/YKi5f8VwCizwGf4tXeLaJ8Anz24/jkrlzwTrVSIh4/cfw3ptbAe sdzDOEwl5drqxjKhpcSYF58nuPgxnwe/d+k5Lg6GlQ7i9/+CAH/bQV4Q1+b31tz4K15k td9/GHR0wBji+/uJ8MHrRv2RXkj8evddZLgskUKfOTpoWFXQQzenDt//MGsmPOfsUaLa bPq3d6lMfN49/e9GueljGrcdY0NV+jqNE2V9yqXi5k4efPtA9XyEU4MG9N6FcTt/BdZN i6sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AL54ucl9rKZtOi9n7cxYrp3sXcKmYEJsp/xosYfzNek=; b=kr4Cr0h5xFeGEArNvdrSkxtfv1aP6nNn/YH+hERoNXo4su0B6AfHjhaO7JftnFcNUd vPAfglRKD5z3GSYpfh4zKQEx07mbD58l2roD2R1/9ZNXVWcdk2YKGdl2qNHxRIXu+ZqX Xx+tLy3lmjIfBwaq9jDgiublcK+l0QZPb3m6RBvlMyOuRECifg15AgujhvqC8OoPjgwz VMcwgJ3nAE4WWSLvmKnQSrXHT0BwWcuNWjc18PeW9n0TbHUkICC3BbiitRPlSx7bQneZ 4g+RnhAJPLxPSkPj5mVIQDekkUHgDaTKoUA7EHO7HN3kBjYp2lbE+KankG+6aHsGLwzz OKyQ== X-Gm-Message-State: AOAM531l/lq73ZEch5rv0RazdauykUVMUwG91mQxILY3/HGjF+SxdpVO wW3t+ikW4Isgj9Q425YvP26h/Ehog5GcLw== X-Received: by 2002:a63:1054:: with SMTP id 20mr1020907pgq.120.1622072835113; Wed, 26 May 2021 16:47:15 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 02/31] exec/memory_ldst_phys: Sort declarations Date: Wed, 26 May 2021 16:46:41 -0700 Message-Id: <20210526234710.125396-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé To ease the file review, sort the declarations by the size of the access (8, 16, 32). Simple code movement, no logical change. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210518183655.1711377-3-philmd@redhat.com> Signed-off-by: Richard Henderson --- include/exec/memory_ldst_phys.h.inc | 78 ++++++++++++++--------------- 1 file changed, 39 insertions(+), 39 deletions(-) -- 2.25.1 diff --git a/include/exec/memory_ldst_phys.h.inc b/include/exec/memory_ldst_phys.h.inc index b9dd53c389..4033795add 100644 --- a/include/exec/memory_ldst_phys.h.inc +++ b/include/exec/memory_ldst_phys.h.inc @@ -20,6 +20,12 @@ */ #ifdef TARGET_ENDIANNESS +static inline uint32_t glue(lduw_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +{ + return glue(address_space_lduw, SUFFIX)(ARG1, addr, + MEMTXATTRS_UNSPECIFIED, NULL); +} + static inline uint32_t glue(ldl_phys, SUFFIX)(ARG1_DECL, hwaddr addr) { return glue(address_space_ldl, SUFFIX)(ARG1, addr, @@ -32,10 +38,10 @@ static inline uint64_t glue(ldq_phys, SUFFIX)(ARG1_DECL, hwaddr addr) MEMTXATTRS_UNSPECIFIED, NULL); } -static inline uint32_t glue(lduw_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +static inline void glue(stw_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) { - return glue(address_space_lduw, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); + glue(address_space_stw, SUFFIX)(ARG1, addr, val, + MEMTXATTRS_UNSPECIFIED, NULL); } static inline void glue(stl_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) @@ -44,18 +50,30 @@ static inline void glue(stl_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) MEMTXATTRS_UNSPECIFIED, NULL); } -static inline void glue(stw_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) -{ - glue(address_space_stw, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - static inline void glue(stq_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val) { glue(address_space_stq, SUFFIX)(ARG1, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); } #else +static inline uint32_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +{ + return glue(address_space_ldub, SUFFIX)(ARG1, addr, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline uint32_t glue(lduw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +{ + return glue(address_space_lduw_le, SUFFIX)(ARG1, addr, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline uint32_t glue(lduw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +{ + return glue(address_space_lduw_be, SUFFIX)(ARG1, addr, + MEMTXATTRS_UNSPECIFIED, NULL); +} + static inline uint32_t glue(ldl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr) { return glue(address_space_ldl_le, SUFFIX)(ARG1, addr, @@ -80,36 +98,6 @@ static inline uint64_t glue(ldq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr) MEMTXATTRS_UNSPECIFIED, NULL); } -static inline uint32_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_ldub, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -static inline uint32_t glue(lduw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_lduw_le, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -static inline uint32_t glue(lduw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_lduw_be, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -static inline void glue(stl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) -{ - glue(address_space_stl_le, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -static inline void glue(stl_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) -{ - glue(address_space_stl_be, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - static inline void glue(stb_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) { glue(address_space_stb, SUFFIX)(ARG1, addr, val, @@ -128,6 +116,18 @@ static inline void glue(stw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t va MEMTXATTRS_UNSPECIFIED, NULL); } +static inline void glue(stl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) +{ + glue(address_space_stl_le, SUFFIX)(ARG1, addr, val, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline void glue(stl_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) +{ + glue(address_space_stl_be, SUFFIX)(ARG1, addr, val, + MEMTXATTRS_UNSPECIFIED, NULL); +} + static inline void glue(stq_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val) { glue(address_space_stq_le, SUFFIX)(ARG1, addr, val, From patchwork Wed May 26 23:46:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448333 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2b0d:0:0:0:0 with SMTP id gc13csp6046793ejc; Wed, 26 May 2021 16:54:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz99uiOOaQDkZbqjJdQOoBvi4s+4NDFeT0tkyJemqDtwVWFiRbE+Oh+TONDSxRvxcMbFSGF X-Received: by 2002:a25:d994:: with SMTP id q142mr782215ybg.93.1622073266957; Wed, 26 May 2021 16:54:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073266; cv=none; d=google.com; s=arc-20160816; b=qiMXE252iI03Uyx+szNaEOw6ctI49Kx2Uhh1wN+7O199hf6coXlilUOuUil4eilObY e96E0REfgi/Wvbtw68iDhaX1FxkqP3XdCp2RgytNl8hf1LXGhL7TNS1LMZSUXHp7j7K+ i+1J39NVwQzT1yedrc+KCHIMsV8UpwlJgcmGyKmAPlYuGzT4dLHB45ABBz5tzBccUYde UGVb7Jd3OVFSnOebckMAJPbXU0r6VHj5g9erCmKVUARFAVY6sOfWbn4Ko9p9VSMkDKNA rL1FtF4RZLWGoubJRwOqjlNlBq2QH9G6sAfozMl06b6JbxAp13We+DMLZKx/JoF3uxsC aehA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=UcCXa7GKI4W/d3/jlaSrG0mCq3KpdgKzNszQYbsDFeI=; b=WRQl8/bwIHyJem8JNpPHZ5VIuaZXf3DboUcIsemlWXR11ERJo0qsWDE3XVC2a8qWmZ Uu3TLg1PeTzWsY0hFj3CEheq5FIrz5dJMKex0JQL0htW0DElcqIq+q+ib1oucjWLQxSp 52B2tOsR4QcYDmVJpmp4EMdM4tCSJVgQfX5sINJEcXQMOY9agBr+kuKNDKCI3MzpcvYN kHfRqSHoa/oCG+AkJXMlxT00bh5YfYHyf6Vqup27UZQVRw/732YRYOV2S3d/vu1y64Nk Y0V6dATgEyoR3pwPq5DSKVQ6Nl8fJ82Wqpqan5mXKOnHeHTL+JeHmK/IiRacYI6lhUYe JohA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QFsGZAO3; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a207si668958ybg.138.2021.05.26.16.54.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 16:54:26 -0700 (PDT) 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=QFsGZAO3; 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 Received: from localhost ([::1]:44254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3M2-0000ip-8U for patch@linaro.org; Wed, 26 May 2021 19:54:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FI-0005br-2h for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:29 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:33430) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3F7-0004Rx-5q for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:27 -0400 Received: by mail-pj1-x102e.google.com with SMTP id v13-20020a17090abb8db029015f9f7d7290so4456111pjr.0 for ; Wed, 26 May 2021 16:47:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UcCXa7GKI4W/d3/jlaSrG0mCq3KpdgKzNszQYbsDFeI=; b=QFsGZAO3YYJWh5kh9+psjXK7Io4S8d/t1TEkXOHidtNQPQK0Zr0RGZ2UdSEO8wzv21 yzOAaPQfS9gSGb9pdfNQOqR1U/A+FSRdXKx92L6uVvZGszh/C/pGmESZ3iEYfUfWuTze IYS4dqu63fivPzjFQ91jhxRU8bas+bFagzlyUGMBQ8blwRQ7A+Gk79QyD0Y5fiXiD3J8 y7CBBsojMjTZa+JQAU8bk+DyK3YnldqNzjpDJQBL5uFgxFru8lFs/+gO4leYZLlRdiwT 2aAyvIWsx0gdwixR9DhhHExjXJ5wlMq0a/GO4Yuf2KzeY8gcmIal7dAk5z06sFM41zwD o5GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UcCXa7GKI4W/d3/jlaSrG0mCq3KpdgKzNszQYbsDFeI=; b=jPMkVjfUUPTxCD1OfcWvQ/qxCzZ+YB1ZzngPHo9nZclbd53qjkeiGFw1apjow8XKUZ 4adLjdxILatP8/DdIrF57zgE57sPmAfzdekO1GcdpczkkC+vVm2/JdnEJN0O0chsBcXq 4LQ6151rm2WjPUm95obI7FHJ3xj3EJSzJ2KKCJJbYYSOZYw703ZnT/0glNb5a/TMiULM xnW83pJczVyQU+Ol0ZqPp30EIcGRcxRJ0RtKx86FK8WCcHiZb/KoduAX+IiRWyZMWEbi cTtGu1M79RZ21VCKNhaD/a92ImxBUX1xBnh9u7ELIcLTaIuXYgXa6QjNgpuZrZ5kPFhX ed3A== X-Gm-Message-State: AOAM5339GkK6Nsr4CcnTxpZJSYOQcXLeDYxH8K+7YB8HXrsd0B4hXc+5 teDdwPZEJaite4IgMSdPZhi3cCrfi6fSIw== X-Received: by 2002:a17:90b:70c:: with SMTP id s12mr692672pjz.98.1622072835834; Wed, 26 May 2021 16:47:15 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 03/31] exec/memory_ldst: Use correct type sizes Date: Wed, 26 May 2021 16:46:42 -0700 Message-Id: <20210526234710.125396-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Use uint8_t for (unsigned) byte, and uint16_t for (unsigned) 16-bit word. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210518183655.1711377-4-philmd@redhat.com> Signed-off-by: Richard Henderson --- include/exec/memory_ldst.h.inc | 16 ++++++++-------- memory_ldst.c.inc | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) -- 2.25.1 diff --git a/include/exec/memory_ldst.h.inc b/include/exec/memory_ldst.h.inc index 46e6c220d3..7c3a641f7e 100644 --- a/include/exec/memory_ldst.h.inc +++ b/include/exec/memory_ldst.h.inc @@ -20,7 +20,7 @@ */ #ifdef TARGET_ENDIANNESS -extern uint32_t glue(address_space_lduw, SUFFIX)(ARG1_DECL, +extern uint16_t glue(address_space_lduw, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); extern uint32_t glue(address_space_ldl, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); @@ -29,17 +29,17 @@ extern uint64_t glue(address_space_ldq, SUFFIX)(ARG1_DECL, extern void glue(address_space_stl_notdirty, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); extern void glue(address_space_stw, SUFFIX)(ARG1_DECL, - hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); + hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result); extern void glue(address_space_stl, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); extern void glue(address_space_stq, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result); #else -extern uint32_t glue(address_space_ldub, SUFFIX)(ARG1_DECL, +extern uint8_t glue(address_space_ldub, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); -extern uint32_t glue(address_space_lduw_le, SUFFIX)(ARG1_DECL, +extern uint16_t glue(address_space_lduw_le, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); -extern uint32_t glue(address_space_lduw_be, SUFFIX)(ARG1_DECL, +extern uint16_t glue(address_space_lduw_be, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); extern uint32_t glue(address_space_ldl_le, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); @@ -50,11 +50,11 @@ extern uint64_t glue(address_space_ldq_le, SUFFIX)(ARG1_DECL, extern uint64_t glue(address_space_ldq_be, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); extern void glue(address_space_stb, SUFFIX)(ARG1_DECL, - hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); + hwaddr addr, uint8_t val, MemTxAttrs attrs, MemTxResult *result); extern void glue(address_space_stw_le, SUFFIX)(ARG1_DECL, - hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); + hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result); extern void glue(address_space_stw_be, SUFFIX)(ARG1_DECL, - hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); + hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result); extern void glue(address_space_stl_le, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); extern void glue(address_space_stl_be, SUFFIX)(ARG1_DECL, diff --git a/memory_ldst.c.inc b/memory_ldst.c.inc index b56e961967..84b868f294 100644 --- a/memory_ldst.c.inc +++ b/memory_ldst.c.inc @@ -157,7 +157,7 @@ uint64_t glue(address_space_ldq_be, SUFFIX)(ARG1_DECL, DEVICE_BIG_ENDIAN); } -uint32_t glue(address_space_ldub, SUFFIX)(ARG1_DECL, +uint8_t glue(address_space_ldub, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) { uint8_t *ptr; @@ -193,7 +193,7 @@ uint32_t glue(address_space_ldub, SUFFIX)(ARG1_DECL, } /* warning: addr must be aligned */ -static inline uint32_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL, +static inline uint16_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result, enum device_endian endian) { @@ -240,21 +240,21 @@ static inline uint32_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL, return val; } -uint32_t glue(address_space_lduw, SUFFIX)(ARG1_DECL, +uint16_t glue(address_space_lduw, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) { return glue(address_space_lduw_internal, SUFFIX)(ARG1, addr, attrs, result, DEVICE_NATIVE_ENDIAN); } -uint32_t glue(address_space_lduw_le, SUFFIX)(ARG1_DECL, +uint16_t glue(address_space_lduw_le, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) { return glue(address_space_lduw_internal, SUFFIX)(ARG1, addr, attrs, result, DEVICE_LITTLE_ENDIAN); } -uint32_t glue(address_space_lduw_be, SUFFIX)(ARG1_DECL, +uint16_t glue(address_space_lduw_be, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) { return glue(address_space_lduw_internal, SUFFIX)(ARG1, addr, attrs, result, @@ -366,7 +366,7 @@ void glue(address_space_stl_be, SUFFIX)(ARG1_DECL, } void glue(address_space_stb, SUFFIX)(ARG1_DECL, - hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) + hwaddr addr, uint8_t val, MemTxAttrs attrs, MemTxResult *result) { uint8_t *ptr; MemoryRegion *mr; @@ -398,7 +398,7 @@ void glue(address_space_stb, SUFFIX)(ARG1_DECL, /* warning: addr must be aligned */ static inline void glue(address_space_stw_internal, SUFFIX)(ARG1_DECL, - hwaddr addr, uint32_t val, MemTxAttrs attrs, + hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result, enum device_endian endian) { uint8_t *ptr; @@ -441,21 +441,21 @@ static inline void glue(address_space_stw_internal, SUFFIX)(ARG1_DECL, } void glue(address_space_stw, SUFFIX)(ARG1_DECL, - hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) + hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result) { glue(address_space_stw_internal, SUFFIX)(ARG1, addr, val, attrs, result, DEVICE_NATIVE_ENDIAN); } void glue(address_space_stw_le, SUFFIX)(ARG1_DECL, - hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) + hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result) { glue(address_space_stw_internal, SUFFIX)(ARG1, addr, val, attrs, result, DEVICE_LITTLE_ENDIAN); } void glue(address_space_stw_be, SUFFIX)(ARG1_DECL, - hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) + hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result) { glue(address_space_stw_internal, SUFFIX)(ARG1, addr, val, attrs, result, DEVICE_BIG_ENDIAN); From patchwork Wed May 26 23:46:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448233 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2b0d:0:0:0:0 with SMTP id gc13csp6043596ejc; Wed, 26 May 2021 16:48:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwA9c2y6CMQVPfctcp2r9CKGbTO/8Nm7OGhnmYZ2TDLEFC8Z0Ce7yxOD2amPldKuC81CZLC X-Received: by 2002:a92:d206:: with SMTP id y6mr720310ily.182.1622072897066; Wed, 26 May 2021 16:48:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622072897; cv=none; d=google.com; s=arc-20160816; b=G3muuD5IkslnclloWMPEgyGj1TQdDS/+5lspf737LAKdSJHQIZkBEMGUMz88l6iaGN lFyh4CQYxvB51N4YJF9o99r26maqw9QK1X9DFyneXJSz7+7f/SS9ZdrRlLLc5q7Yafhf CZNhRgKdYP05i0QHgoSFPQmFL5YsartroP4yD4fMXHn2DdGoV5yAghi+BC8U2flHBS+X 1j84unO0iFGD/TQp69Nr37py/VZY0DSGSK74jc24GW5l243PEJt0iDbe8Qzr26RovlvW T3Ss7XUPKOwI9sZY5+FuZ0FYGSojNPJVi4OKRUTG/p3HXEkwzDZZ0D0Y/O50ipPAUitU zcyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=ctF8jI1PInVtqpUhepZanIEwZw+6zytZ0vAzr9xJPtk=; b=vYVLFFeRW//AhE+AcH3ymLQfJej6wn107+Ns3hjkjulnSXfgeMbV7y6StHRgKbrgV1 XzdN+DglHUBus8+INfgEC/syuipTf7DQmoVhz699byDDchL5zmTfz6bD8MKptw8+1HxH OrAcsLLAHFejyjMxSpfcXcdfXjeKE0+S/6tZYzSfPvOTEz3ptrlHzBvUwEQrgI6IHgmQ AUyz/G/cQ89dANK9c3/XBTHM5SsatwgsVB/cFiuCEKJA9pwtLfVoO8VFoiFI0HvLhW0k MzxiBGwIYyDIkY6WCvW22khR9yqjiqI2uO6J0x8jSsv8kJpZJcWYmdDKI16QoTKJhfri b54Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PFpX273T; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r17si480730ilq.4.2021.05.26.16.48.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 16:48:17 -0700 (PDT) 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=PFpX273T; 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 Received: from localhost ([::1]:55756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3G4-0005gC-9h for patch@linaro.org; Wed, 26 May 2021 19:48:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34698) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FH-0005bF-LB for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:27 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:41912) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3F9-0004S3-Lf for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:26 -0400 Received: by mail-pf1-x432.google.com with SMTP id p39so2206395pfw.8 for ; Wed, 26 May 2021 16:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ctF8jI1PInVtqpUhepZanIEwZw+6zytZ0vAzr9xJPtk=; b=PFpX273T5S9DW9mYxZkh0PWBtKf4hHYjOEiTHmzfozmBZOy0tO8V/zzwx30xnDQOy8 vXp3nfusgbFK/zxVd5rMgi7PHCDqTvxvMTXSkq0GqUKLoHpDBBLWbIMWWqCD3J0f/eXL NO91gYcL/lmJd53lx0a3l5VIFf1C5dgHz3u8tcjI6guPDRL3BAbo3rqhbP+Ava/LbzI1 y5/C2DB+QjDgXZPYdlM9XxgQqklaaziW1a1Ag2BW2Gl1tipl1Zu5Fl1Y7hNVRgQ6w6BR ew6QPT4HM1VHOcGh0LAl7+nMu/9m54kWEjHUQ95AoURcL1bePVid9TjlUR0YSxYguox0 WP7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ctF8jI1PInVtqpUhepZanIEwZw+6zytZ0vAzr9xJPtk=; b=VIRiXNbvndBVbix5Cd68n7FERuVxcl6FQdu779nixrFThRphnlyXa2VfbuzkbOpQMn W5mWkx6jx4NVVlb6IKIJABtSqH1iaVNsAwUItsyxWq6g6Mz8ZvGSWEFHnqQ3js5ynNVD qiOIsGLp12RXWVNi3qtir83NSesFnGIyG99TeQI2sSvr6fUTehfyv4v8bxjPd+XziHYJ ksz/TgSDoVkHoyUQsXHRf0xMTgVrLTDs6OVYJ0XlnEM54pRU3Ksr6j1o2XvIJnVJUclV FTBTFs1qluQ8Z8uMD00SKlU1+08jcukX1GvUmlmX/EiSj6AoH/IyeeAEzdtKK05QsYuZ bCMA== X-Gm-Message-State: AOAM533E1GfBrOFqHUGKyaLKrLS70pNKN3mI7e19Gr7H1kG07Kyn3gJg dm3CfFiC70WZYsZ1YLZdcvzIWpgcfm9wag== X-Received: by 2002:a63:3e4d:: with SMTP id l74mr995274pga.257.1622072836405; Wed, 26 May 2021 16:47:16 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 04/31] exec/memory_ldst_phys: Use correct type sizes Date: Wed, 26 May 2021 16:46:43 -0700 Message-Id: <20210526234710.125396-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Use uint8_t for (unsigned) byte, and uint16_t for (unsigned) 16-bit word. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210518183655.1711377-5-philmd@redhat.com> Signed-off-by: Richard Henderson --- include/exec/memory_ldst_phys.h.inc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- 2.25.1 diff --git a/include/exec/memory_ldst_phys.h.inc b/include/exec/memory_ldst_phys.h.inc index 4033795add..ecd678610d 100644 --- a/include/exec/memory_ldst_phys.h.inc +++ b/include/exec/memory_ldst_phys.h.inc @@ -20,7 +20,7 @@ */ #ifdef TARGET_ENDIANNESS -static inline uint32_t glue(lduw_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +static inline uint16_t glue(lduw_phys, SUFFIX)(ARG1_DECL, hwaddr addr) { return glue(address_space_lduw, SUFFIX)(ARG1, addr, MEMTXATTRS_UNSPECIFIED, NULL); @@ -38,7 +38,7 @@ static inline uint64_t glue(ldq_phys, SUFFIX)(ARG1_DECL, hwaddr addr) MEMTXATTRS_UNSPECIFIED, NULL); } -static inline void glue(stw_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) +static inline void glue(stw_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint16_t val) { glue(address_space_stw, SUFFIX)(ARG1, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); @@ -56,19 +56,19 @@ static inline void glue(stq_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val) MEMTXATTRS_UNSPECIFIED, NULL); } #else -static inline uint32_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +static inline uint8_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr) { return glue(address_space_ldub, SUFFIX)(ARG1, addr, MEMTXATTRS_UNSPECIFIED, NULL); } -static inline uint32_t glue(lduw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +static inline uint16_t glue(lduw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr) { return glue(address_space_lduw_le, SUFFIX)(ARG1, addr, MEMTXATTRS_UNSPECIFIED, NULL); } -static inline uint32_t glue(lduw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +static inline uint16_t glue(lduw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr) { return glue(address_space_lduw_be, SUFFIX)(ARG1, addr, MEMTXATTRS_UNSPECIFIED, NULL); @@ -98,19 +98,19 @@ static inline uint64_t glue(ldq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr) MEMTXATTRS_UNSPECIFIED, NULL); } -static inline void glue(stb_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) +static inline void glue(stb_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint8_t val) { glue(address_space_stb, SUFFIX)(ARG1, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); } -static inline void glue(stw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) +static inline void glue(stw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint16_t val) { glue(address_space_stw_le, SUFFIX)(ARG1, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); } -static inline void glue(stw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) +static inline void glue(stw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint16_t val) { glue(address_space_stw_be, SUFFIX)(ARG1, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); From patchwork Wed May 26 23:46:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448323 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2b0d:0:0:0:0 with SMTP id gc13csp6045479ejc; Wed, 26 May 2021 16:51:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxq4USlTK7Im7+H8ZgiAzjnhtI+REAoa9ObPlwkNAO0ZjVwxjFfE70VPVUUXN2DwCkOnBQC X-Received: by 2002:a92:d4c7:: with SMTP id o7mr716627ilm.130.1622073119266; Wed, 26 May 2021 16:51:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073119; cv=none; d=google.com; s=arc-20160816; b=SjeYrCJbl0a3IU9aHfRdqh+vMT9STqhmPc6G1JCHVLc+vNjBjmQtE9sjUm9gTueorS zu+1ZWYx43vad5FxWksQ1fSeAFsGC95UY5LsTh9J0f4LJ7m9/7QJ5vSDVGYxZ79ptwXO PuJxfrMfz/VCxM5pDirnghpxs66pOlfAq77o6imKkQGeyvS/zMmwZVaeRG/j4Xex97VP H2/0VMY6kgXT5SDPSPlSqbAPOeDPK8JLwvfFqG/8hGKXaaFLCm5xR7+OPxJoig16DGzS x/l929dzqmlN3uVrsV3xr4YFYwXhDPe07SrHgECLW1WA5LGLiM5dVjSDEQ1as8YqpTgv 2Sdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=GwFPfaEmVEpOzuuThVVY+CbHhMoholSixs381w2V9KE=; b=D03Fx/JYaAM+wn1oQMsQO5hNavLSVLmnGf7Jt7obx3CDU9ySgE3WGBtbRRJAqzIEnZ Pl2u7oMDyFVtt2ij0X91W2VuLehxQzPXHCZiyzKY0pIeAlLqL9PF7YTM9AuSd5dHMhTZ QrCJ4RkrnjnXTMEWqs0+P4kqk0BWIfXXhVwn5oIieRJ8VxJAK6rgjOZoNHI/RBx6JZc9 cczZQHBCD2oA9zupT3BN5vlNeldXrh8QESBvGlVtfU34/Iix0JfzIW1WzFfj+K3MYwCu jRUccd58b9bc4cTILUmdVi/6u2jmEFOzXuSDaJVeGFY8s0RPARDJbbSlRme4iV5IjLg4 T+/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y4ruGN8E; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d70si717579iog.4.2021.05.26.16.51.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 16:51:59 -0700 (PDT) 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=Y4ruGN8E; 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 Received: from localhost ([::1]:35898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3Jd-0003Ok-W4 for patch@linaro.org; Wed, 26 May 2021 19:51:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FI-0005c3-SF for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:29 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:45992) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3F9-0004SU-Mt for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:28 -0400 Received: by mail-pl1-x636.google.com with SMTP id s4so1409285plg.12 for ; Wed, 26 May 2021 16:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GwFPfaEmVEpOzuuThVVY+CbHhMoholSixs381w2V9KE=; b=Y4ruGN8EFpTFVXiT0gmCtMSfPq8HSfelI7epdpjobZuUwkWtrbR2H1K758tHNSU35j Sz2mmBmf5s0bRrdP6yyomAwF3KBfexQMbCxw02mLTuahY6sSn58F/NOh1H3AHWsSNtq4 hmWPCGhhxGndF2uDd1rMnTpqbauyxRrWI5LM+TDpoUfHlBlD9YatW/eR7tsW4XWwl3mv xgiwss3fO5tsPLLs8GQr2g3mvIJTkZt96TVLGfHcw5vAxA5R61KM6gJPPgJzhUV1zeOM g1l5rxlTQR2MzJOaXfaTQBetySkJ+fwhHb9TYGflj+02s8rVMbzsxYl1Ow28GehanfTu 5WaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GwFPfaEmVEpOzuuThVVY+CbHhMoholSixs381w2V9KE=; b=tAk/iDV+SpIwzF1oVHU/PmyKUnc8xKehfMksx1D1Vlk71teh4mYb0HrPqMh7rXCPn8 5D6Ck49VkBef5qaQYzGV5Cajd6wknJrNOWsW12/Kwg708wxoVdrAq6/Ev+y2YPJHZ/W3 Qy6ox9wInOhMm6ff7PJPQUXT51zb3demc7zhDyqtj0ESdo/4FYyitJbNqzM5IDqDP7BB lEmcrLehpynuYcfBy7KH6BnL9xKTYc2qEnW/DN0ANFN3Ti2wvR8FbCz0QFM0HnQJCAyP hK6/Osvfb8qT3s2iFbq/uN5VwjeqfyfZCVmid0MT1ITA/Tm0dqzBDc6jw2IK/FvTpVaE Ovzw== X-Gm-Message-State: AOAM532h32bj36H/DTY/bzdKD6Hd9aLI7HPM6iadDYQZ8du5eKESvbcz o7XUMtyqVoesjaWvGm7ZKd9sux4GysUrDA== X-Received: by 2002:a17:90a:e2ca:: with SMTP id fr10mr6519973pjb.6.1622072837084; Wed, 26 May 2021 16:47:17 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 05/31] exec/memory_ldst_cached: Use correct type size Date: Wed, 26 May 2021 16:46:44 -0700 Message-Id: <20210526234710.125396-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Use uint16_t for (unsigned) 16-bit word. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210518183655.1711377-6-philmd@redhat.com> Signed-off-by: Richard Henderson --- include/exec/memory_ldst_cached.h.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/include/exec/memory_ldst_cached.h.inc b/include/exec/memory_ldst_cached.h.inc index c33449d0cd..d7834f852c 100644 --- a/include/exec/memory_ldst_cached.h.inc +++ b/include/exec/memory_ldst_cached.h.inc @@ -24,7 +24,7 @@ #define LD_P(size) \ glue(glue(ld, size), glue(ENDIANNESS, _p)) -static inline uint32_t ADDRESS_SPACE_LD_CACHED(uw)(MemoryRegionCache *cache, +static inline uint16_t ADDRESS_SPACE_LD_CACHED(uw)(MemoryRegionCache *cache, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) { assert(addr < cache->len && 2 <= cache->len - addr); @@ -72,7 +72,7 @@ static inline uint64_t ADDRESS_SPACE_LD_CACHED(q)(MemoryRegionCache *cache, glue(glue(st, size), glue(ENDIANNESS, _p)) static inline void ADDRESS_SPACE_ST_CACHED(w)(MemoryRegionCache *cache, - hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) + hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result) { assert(addr < cache->len && 2 <= cache->len - addr); if (likely(cache->ptr)) { From patchwork Wed May 26 23:46:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448324 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2b0d:0:0:0:0 with SMTP id gc13csp6045729ejc; Wed, 26 May 2021 16:52:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+LzJ+nNSBwmdsAtQGL9MN+qekDjG59ItBH1TrAqUT3gBlQRW5v1NzmnujEkp/9cG4N4FP X-Received: by 2002:a02:3304:: with SMTP id c4mr712942jae.68.1622073148745; Wed, 26 May 2021 16:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073148; cv=none; d=google.com; s=arc-20160816; b=tty3U/oqX4Gf9cM6tK+Lg8kdFAdC/0+rJbqlpz/h2sm24k+646oNDWvoWbie6BgSbI a88DzChoczQDyWCxIZEgPPaTrAbd+0WNa3miiVHfkX7gztHW0gJotZZRr7en3KekqBNH BqfMpdnkN4DT1c9C4uqZljAqvJtcl0e7wF9jSrITYtxDkwhPXN9nUULNg7GATEMboe+5 tQaC63RmeRPP/ftXyASFGPIGjldNg2vxH3lq5pruKhlFK1VVwO3Ke2gLTWJqHTlOnIrj y/AbKekslkYqyJiAMxAVR5UKQXQ3K3PFvRQPaz2HmkWvPdNWyhZYwpYtlECQ3TmW37mk JZLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=dWI9mP5oW4fro3AiRaLHN8aGTJl30ssHDjRGYrYCC60=; b=bhEz3i7/i7wcyoSMzIOTN9jPSxkVUnkOOKNj/oIg1axO0hc/F7Di0a4B55QTWUq24W zbuQ+MT0gpdCDFgNslMQRDnXcGW0IhezA733uOZCCTWh9E0cP6fPO6VwrAtvfYtZy9sE z1ST2dvQ9Av4FNSRv1Yr3qBeaEtwj5SFeXAHpTt6YTzbT9jxooXzdBhChHE9PG11mFA9 8ktDHWnw+ECKzWPK5cdK2O1T3SPLdIwtSz7rIl48GnmSyxvA0Lvf90AvT9Op+e0Qz4AW enKKIUzQh2eF+ZNKVUdeSm9G+fhwpFd5zf97NS8wKx6dmegOD64OTUJoEesAYqag4u7a wkHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tFrWAlV4; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i10si549816iog.60.2021.05.26.16.52.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 16:52:28 -0700 (PDT) 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=tFrWAlV4; 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 Received: from localhost ([::1]:35986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3K7-0003Sl-VI for patch@linaro.org; Wed, 26 May 2021 19:52:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FH-0005bi-VV for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:27 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:33550) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3F9-0004Tl-N0 for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:27 -0400 Received: by mail-pf1-x435.google.com with SMTP id f22so2239362pfn.0 for ; Wed, 26 May 2021 16:47:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dWI9mP5oW4fro3AiRaLHN8aGTJl30ssHDjRGYrYCC60=; b=tFrWAlV4z3mgHCOLJOoR1DvLBkSAGfqhc2p35VCH5UFA9iznA5//p7qobSd/4R2lFt FYxSLfvaZ8LC8bi5y2hpSPPN2/rJGjn7dA+zjvi3D6AokO+kbCE6LZ+6mL5x8EA3SvOH RpdmcvkOCuJbFIfkcDK0glplJym3LsJnUM1twsjRLPcnLDRxGjvJt/psg+40tHjZyWZ2 4Ot7XvJr9oL01JTmrCfyZjmkcb4OmzN6PZSAb0sEqZHXtNOc8xnxm96xoi1HFnEz4nsu Y/7eqOgveLPyEjKUa16//V2J7fbuKFj2dVuE8WSOksaIrT0RaPQasVxp6E1feJVnSPQ2 4h2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dWI9mP5oW4fro3AiRaLHN8aGTJl30ssHDjRGYrYCC60=; b=ap7X0nsPclwRz/myihWOlnahMSvZMJAfOEIYqEa9a3ji8EqdUmK0utntqQgr1S+kkr O9eE6SynRayL3wEecL8cYpGuSGCJcyd/8Hz+Ij4gpf9xHOw1An2skLhrKO0f0MhzZaUF pFZHRHwj8l+o3veBvBd6Mb+sO0WmLQeB43YHtHRTRvAfU1uT2xF+YJY8FWRuGTsTbFeq Rw/4kffMWyE+bMlAJKZWBHVSBjfDnFTAgdGGG8W6uAQ0JVK6/ASqACQTd0ZY8W68EUoq 1TH5/uZfkCsupFuInMNMbkoiImRzGOuH4wH2zUVETce7rGeqlHFXjgT306XvVC+gp41H ipBg== X-Gm-Message-State: AOAM533cUR50zdH6lMM6a5m6PCV0TyO+U0IWujIi7BNqbKfiu9oTnVBD sxzxDuiskUq/QOxSTKkUmtEbkXPtW3XXKA== X-Received: by 2002:a63:974a:: with SMTP id d10mr1041992pgo.180.1622072837868; Wed, 26 May 2021 16:47:17 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 06/31] exec/memory: Use correct type size Date: Wed, 26 May 2021 16:46:45 -0700 Message-Id: <20210526234710.125396-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Use uint8_t for (unsigned) byte. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210518183655.1711377-7-philmd@redhat.com> Signed-off-by: Richard Henderson --- include/exec/memory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1 diff --git a/include/exec/memory.h b/include/exec/memory.h index c8b9088924..175d7151a5 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -2305,7 +2305,7 @@ static inline uint8_t address_space_ldub_cached(MemoryRegionCache *cache, } static inline void address_space_stb_cached(MemoryRegionCache *cache, - hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) + hwaddr addr, uint8_t val, MemTxAttrs attrs, MemTxResult *result) { assert(addr < cache->len); if (likely(cache->ptr)) { From patchwork Wed May 26 23:46:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448234 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2b0d:0:0:0:0 with SMTP id gc13csp6044150ejc; Wed, 26 May 2021 16:49:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRiEFKhlGdd2fed48M54oDaTGgJ4r2UAtrEcECXmFb02fnWD0gMo1UfujVxnDBhaLTpPd4 X-Received: by 2002:a05:620a:2e4:: with SMTP id a4mr690502qko.250.1622072962830; Wed, 26 May 2021 16:49:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622072962; cv=none; d=google.com; s=arc-20160816; b=maACVI0XZ6LoY99jhVybiEY2n/ssNfBD+oCLafwd89NFlXIeAZnFgvCcYy+w6rILCO ire5knEKmLIGA4ETvk39ilv4a2nonYOC2IeSDLxqaaUJRsKVGJ/rxAR+LahF7JQgvnFq IntxlT6qADnPDRTZJLw9E0SqQSplwXIlS5u0Dzx6lWPgV09wsrQ1RdkMlbBsev0MfnwM ntcwDuPkyOcZCTctI19LGvLnk9HikB/buG2IycUyRqRyhVGZ7fyCf8LSMT7R3IKNiyYE w4d+xlq3B1lvnQ/SeMWyUGRBgYNQJIR1p1Qb1501g9jXFhgfpef13rrsbsZUnicTrIgH apHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=NKrR+Y1HHSCDluHdieEW79BiIBCD6gCzbNQyl4SjDwo=; b=LOmhu6oymRMJ3RJEpS/EGdhe18CF7uc4TxfPWAigdv29jE7BdvA1jbZZGzM1pI6sUJ csJdm+trKqN/3PCeUQdPUU9dAXvkhaeUqVaxgA62Phy2UXbaAW+wE0pD0siGJySfIGyw usATBgyCOncsrXwzSv/DVVa9/cqjveARa7A1f5ybnsoDjhrpdHoxiNWkcZOT2N92p48B ztGjN/RxsK44xIGvgyJOjMImnx4NxE0IECPTucNOsLYHIQ+xbxeZ9G+GegmuhBs+m2xG 5AqjMX+phzWbvUdRC7SR6yAMwkcPve+g6rfAJtixFNVrb2SNUQdk1B2Mda7e7OQYZkob 135g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pPkVqmsY; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q2si451210qtn.298.2021.05.26.16.49.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 16:49:22 -0700 (PDT) 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=pPkVqmsY; 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 Received: from localhost ([::1]:56054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3H8-0005uC-3V for patch@linaro.org; Wed, 26 May 2021 19:49:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FN-0005gH-1H for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:33 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:38815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FB-0004To-MJ for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:32 -0400 Received: by mail-pg1-x531.google.com with SMTP id 6so2296282pgk.5 for ; Wed, 26 May 2021 16:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NKrR+Y1HHSCDluHdieEW79BiIBCD6gCzbNQyl4SjDwo=; b=pPkVqmsYA/T5h4tjidjw8D5DDXKdQGPUiDcVfPV+/UPFIBOS1nYDuJvFquAbZ+q6Dh s3SvVonUhR6lzc2WyVk6GFQEEq+wnDjdacLajx1wv52G1aOkb+khcriPwhjuw3tWiHl7 i1ElN47eoANZYm04hkulvI/3/+Tg12yHrWQohiWTzpMAs6XCnZc5CAO5DmXShpxw0wGC T48MMSVgv2rCi/8We7PGSbs2ftcJll/lySLaJrYTFGUB2abSrQLMJzefXuLZfv1gtGf8 8AbGHlthThYRNSfnGH7HMIEm/RFjglwJNZurFCk8mIR+Lsw7oUZC5jqCOBBIkygbgVrE 0plA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NKrR+Y1HHSCDluHdieEW79BiIBCD6gCzbNQyl4SjDwo=; b=gJNFxnELHiShfAXL77appI2ERuEwQsPp91epWRCs8D6YjxO0uPjCVSTKdbfajwSLqT ub7lPBmnC/Qdz7zUUwYizJEA9fwvnMqTYesJ6kybVINIbyoBw/agoouRfhQLVP8oXLVO 32QIQe9eplwYc+3T82lbGZh0UoXeFtDxwrxDUIO7GXS3lcx8hb4ncwuPcMnzLoW64eXR VqpT1PLpg6//vuw2X/noRpiEbS+M0zWt8/FnMcMWNUhiutel+jL5FueRbqCLntvIAcAN gQGX2j4ybIESII4XGiFZfE53HL1Z0nVy/jY4vlBz9PDTxgvxtTGyaqMHHl4AOd8hL9ZM hrBQ== X-Gm-Message-State: AOAM530S65ZJLHvSRX4qyw9TbFF8s3kZjtV8H5idljofffh6WLNWU8T1 gFnpQUovnNCo0kjNgSmXPo37m9khldzruA== X-Received: by 2002:a62:30c2:0:b029:289:116c:ec81 with SMTP id w185-20020a6230c20000b0290289116cec81mr960600pfw.42.1622072838487; Wed, 26 May 2021 16:47:18 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 07/31] accel/tcg: Reduce 'exec/tb-context.h' inclusion Date: Wed, 26 May 2021 16:46:46 -0700 Message-Id: <20210526234710.125396-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Only 2 headers require "exec/tb-context.h". Instead of having all files including "exec/exec-all.h" also including it, directly include it where it is required: - accel/tcg/cpu-exec.c - accel/tcg/translate-all.c For plugins/plugin.h, we were implicitly relying on exec/exec-all.h -> exec/tb-context.h -> qemu/qht.h which is now included directly. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210524170453.3791436-2-f4bug@amsat.org> [rth: Fix plugins/plugin.h compilation] Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 1 - include/tcg/tcg.h | 1 - plugins/plugin.h | 1 + accel/tcg/cpu-exec.c | 1 + accel/tcg/translate-all.c | 1 + 5 files changed, 3 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 8021adf38f..754f4130c9 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -21,7 +21,6 @@ #define EXEC_ALL_H #include "cpu.h" -#include "exec/tb-context.h" #ifdef CONFIG_TCG #include "exec/cpu_ldst.h" #endif diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 0f0695e90d..74cb345308 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -27,7 +27,6 @@ #include "cpu.h" #include "exec/memop.h" -#include "exec/tb-context.h" #include "qemu/bitops.h" #include "qemu/plugin.h" #include "qemu/queue.h" diff --git a/plugins/plugin.h b/plugins/plugin.h index 1aa29dcadd..55017e3581 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -13,6 +13,7 @@ #define _PLUGIN_INTERNAL_H_ #include +#include "qemu/qht.h" #define QEMU_PLUGIN_MIN_VERSION 0 diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 0dc5271715..10e11f27bb 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -31,6 +31,7 @@ #include "qemu/rcu.h" #include "exec/tb-hash.h" #include "exec/tb-lookup.h" +#include "exec/tb-context.h" #include "exec/log.h" #include "qemu/main-loop.h" #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 640ff6e3e7..e9f4de5190 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -48,6 +48,7 @@ #include "exec/cputlb.h" #include "exec/tb-hash.h" +#include "exec/tb-context.h" #include "exec/translate-all.h" #include "qemu/bitmap.h" #include "qemu/error-report.h" From patchwork Wed May 26 23:46:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448336 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2b0d:0:0:0:0 with SMTP id gc13csp6047178ejc; Wed, 26 May 2021 16:55:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRWYyQrs1M17VDCJexqEbhQe7lIGri4yvWFvccdFexpVQ6hJymXnPujyCCeiuoqKKeIDpo X-Received: by 2002:a05:622a:11c3:: with SMTP id n3mr656952qtk.211.1622073308878; Wed, 26 May 2021 16:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073308; cv=none; d=google.com; s=arc-20160816; b=UCePIQlssQgX22DuorJw8fbJ95djylxiEmYeYPA/DdYwpGpTUeT9r/aKFpKNiosJbZ BR56OGwWXHFbzh/58uPG27q/d6QeRz9etrw3ORebwRJsgWlCjLmmNRjBuHyRAk5FE7f8 GI80GT527vDcSFlSZv8A2NqRkaD+Of5IPHFT0774dzs4f83KVb8no+SJBtblhnnTZzk0 16X5KPp5rOVNTP6/y5SDZmsXwoY17cIG7U7YPjgIXgXqWDqjYXLPkx0O2V5oVSSi7JvS /niKXEWhPiqCmt7+PG9EHidQ+kr+JkDrMlPoNbqlopJhAB9BL0vvjca4Jo6yDy0F4O7o Bd5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=+qXhpK9E+3ZMIr8DgyUCNEWWCWtWcLGiTUcEr5+3/Pc=; b=itfv8pLBJGlzlZC8GSMhgyTMtIhIrTPYqJ2XEmBiEWMweRTsKNDu1zsq84NUUamkvQ Nu5kOLYxE5e1hIPfox+0MsfS2AsQ5Tuq32f1bVeKRfBb5c95wx+/irEl/D15BUd9JW3y gVVfX/vnfmjVduuKoYOK2YCAZMfOiPvk8eGZm7k5cCuEZsl3swsEEzt0MeHDdH9aO/Ew 29ofzUw6gHzrsaDUZHZbf46wK3FrpQCIlz6v8MW7qU8Vsi/Nao+/lTTauiOhom9wQyqQ HPDUxZeX/naqXd9MsaNkmKy6HaX0fbf2KdjxzefjDotGiq/ZkOUSCgOL6UkrN/d/MHqU i/Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JELvpquG; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p13si413274qvg.60.2021.05.26.16.55.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 16:55:08 -0700 (PDT) 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=JELvpquG; 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 Received: from localhost ([::1]:49096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3Mi-0003yY-2n for patch@linaro.org; Wed, 26 May 2021 19:55:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FM-0005eP-7u for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:32 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:41485) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FC-0004U6-Pg for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:31 -0400 Received: by mail-pg1-x52f.google.com with SMTP id r1so2295985pgk.8 for ; Wed, 26 May 2021 16:47:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+qXhpK9E+3ZMIr8DgyUCNEWWCWtWcLGiTUcEr5+3/Pc=; b=JELvpquGO2TsBjw4UD0TAUsdgW7P9SVA1gAgGZk1iUmuyev+MfNSXDgUY+oMOYBQqa Z0Di4a+9NNZwVddHMiX0JXpWXCTSMXvqeHTrb8lPSxV28UBk+KTO2LIGLwq8XaHVu97D tOdY/b3lWVDBDx6f4XWzRmvkIzowsuscuoIVLl8Y60jI0LzVnNZGiH3TojqGCXr0hIQY BRNS92tNeF+Ve+qrByy7aSkRNov5yz1jbeROyM9f1C1QRxIUbeBqahnpvhRmyYO06Kf7 ZvDncu3/eZpRDrHhBbjqNS24yjad+7vZ7umeX7RjVyWhNk2iwkELGFN0ij3dvEmQtG5O bX6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+qXhpK9E+3ZMIr8DgyUCNEWWCWtWcLGiTUcEr5+3/Pc=; b=YqweHJeozG7ey6MZxGq2BsQcRjMBFafdlKxdEDd0pgQteGdXHl/Ple/pTOLXdyflUD E5K5cIX+hxXtXvArrk8oR1JzYdlJn4WTvOehh454+3eY0qvklf3+X6xRuyGei0PoxKKa Nm2LQdWUMpzBg0BsFLZpR5Jj0l+gCPgS8jl/Svm+x3Z4TZ4oH74LDo48g8uT3zLtlRYI lrVwWOrcLBHEYRp0j85qOoNaB7yFkr1iSufsS8D9DboClJJipSLH47QgfUo7+bI1CMCX Mago5kJVxWj7V9h/9N287UhyjBkwW60FvP33Pv6t8/KbG8hIo4UP+aY5b+BQf+9NmHQK z+vw== X-Gm-Message-State: AOAM533f+tBVJI20XPyIfiMhSdD5XJTUtTSJVrBCJmbwUCMzYcu2HgD0 zUov38Pnhp4ldgjcKS6CIBMBDgkGQ6kwcw== X-Received: by 2002:aa7:8b4f:0:b029:2bd:ea13:c4b4 with SMTP id i15-20020aa78b4f0000b02902bdea13c4b4mr936498pfd.48.1622072839318; Wed, 26 May 2021 16:47:19 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 08/31] accel/tcg: Keep TranslationBlock headers local to TCG Date: Wed, 26 May 2021 16:46:47 -0700 Message-Id: <20210526234710.125396-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52f.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Only the TCG accelerator uses the TranslationBlock API. Move the tb-context.h / tb-hash.h / tb-lookup.h from the global namespace to the TCG one (in accel/tcg). Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210524170453.3791436-3-f4bug@amsat.org> Signed-off-by: Richard Henderson --- {include/exec => accel/tcg}/tb-context.h | 0 {include/exec => accel/tcg}/tb-hash.h | 0 {include/exec => accel/tcg}/tb-lookup.h | 2 +- accel/tcg/cpu-exec.c | 6 +++--- accel/tcg/cputlb.c | 2 +- accel/tcg/tcg-runtime.c | 2 +- accel/tcg/translate-all.c | 4 ++-- MAINTAINERS | 1 - 8 files changed, 8 insertions(+), 9 deletions(-) rename {include/exec => accel/tcg}/tb-context.h (100%) rename {include/exec => accel/tcg}/tb-hash.h (100%) rename {include/exec => accel/tcg}/tb-lookup.h (98%) -- 2.25.1 diff --git a/include/exec/tb-context.h b/accel/tcg/tb-context.h similarity index 100% rename from include/exec/tb-context.h rename to accel/tcg/tb-context.h diff --git a/include/exec/tb-hash.h b/accel/tcg/tb-hash.h similarity index 100% rename from include/exec/tb-hash.h rename to accel/tcg/tb-hash.h diff --git a/include/exec/tb-lookup.h b/accel/tcg/tb-lookup.h similarity index 98% rename from include/exec/tb-lookup.h rename to accel/tcg/tb-lookup.h index 29d61ceb34..9c9e0079da 100644 --- a/include/exec/tb-lookup.h +++ b/accel/tcg/tb-lookup.h @@ -14,7 +14,7 @@ #endif #include "exec/exec-all.h" -#include "exec/tb-hash.h" +#include "tb-hash.h" /* Might cause an exception, so have a longjmp destination ready */ static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc, diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 10e11f27bb..ad1279d2ed 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -29,9 +29,6 @@ #include "qemu/compiler.h" #include "qemu/timer.h" #include "qemu/rcu.h" -#include "exec/tb-hash.h" -#include "exec/tb-lookup.h" -#include "exec/tb-context.h" #include "exec/log.h" #include "qemu/main-loop.h" #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) @@ -41,6 +38,9 @@ #include "exec/cpu-all.h" #include "sysemu/cpu-timers.h" #include "sysemu/replay.h" +#include "tb-hash.h" +#include "tb-lookup.h" +#include "tb-context.h" #include "internal.h" /* -icount align implementation. */ diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 2f7088614a..f24348e979 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -24,7 +24,6 @@ #include "exec/memory.h" #include "exec/cpu_ldst.h" #include "exec/cputlb.h" -#include "exec/tb-hash.h" #include "exec/memory-internal.h" #include "exec/ram_addr.h" #include "tcg/tcg.h" @@ -36,6 +35,7 @@ #include "exec/translate-all.h" #include "trace/trace-root.h" #include "trace/mem.h" +#include "tb-hash.h" #include "internal.h" #ifdef CONFIG_PLUGIN #include "qemu/plugin-memory.h" diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c index 49f5de37e8..66ac830e2f 100644 --- a/accel/tcg/tcg-runtime.c +++ b/accel/tcg/tcg-runtime.c @@ -30,7 +30,7 @@ #include "disas/disas.h" #include "exec/log.h" #include "tcg/tcg.h" -#include "exec/tb-lookup.h" +#include "tb-lookup.h" /* 32-bit helpers */ diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index e9f4de5190..1eefe6ea8d 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -47,8 +47,6 @@ #endif #include "exec/cputlb.h" -#include "exec/tb-hash.h" -#include "exec/tb-context.h" #include "exec/translate-all.h" #include "qemu/bitmap.h" #include "qemu/error-report.h" @@ -61,6 +59,8 @@ #include "sysemu/tcg.h" #include "qapi/error.h" #include "hw/core/tcg-cpu-ops.h" +#include "tb-hash.h" +#include "tb-context.h" #include "internal.h" /* #define DEBUG_TB_INVALIDATE */ diff --git a/MAINTAINERS b/MAINTAINERS index a77f246569..5f55404f2f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -128,7 +128,6 @@ F: docs/devel/decodetree.rst F: include/exec/cpu*.h F: include/exec/exec-all.h F: include/exec/helper*.h -F: include/exec/tb-hash.h F: include/sysemu/cpus.h F: include/sysemu/tcg.h F: include/hw/core/tcg-cpu-ops.h From patchwork Wed May 26 23:46:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448327 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2b0d:0:0:0:0 with SMTP id gc13csp6045982ejc; Wed, 26 May 2021 16:52:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrwNnwElpOcUNa0UF/o6q4vB1/ZtYIcjwFExWfJcFMN21r+3bxWhWQOpSL3tMVSwdSb8M8 X-Received: by 2002:a02:9443:: with SMTP id a61mr700918jai.60.1622073174533; Wed, 26 May 2021 16:52:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073174; cv=none; d=google.com; s=arc-20160816; b=SVK4f8uey2MrQFTKXlcyK+h6/Y8tidvmKAmLoZ8KsRG0wvoVxVluZOwaYCI/+1WWMo 3+oQinTx+Auilpm8uFgdZpNltzlnTk2W8Wkzn9SoilIz4U5rzjQVeheYgh2HlpILmvKj H6jOwbwDuhVbT6stewgWg5LXkl+Q8cdAKFbzOtGftRgpQqXaz6+VQnehtE61qa0Zmib9 QWFZtX9VbGnaPMdSTwE2EYLHYI0yFPzt72xa3ZxhCVIvWV6a9hZV9zSnKv070kiBZ4u6 6ZVfDWqoWKjJBz8xPcxPc4huhCWQD9ZFzpAD2Ja/3WKG6Vh5EAF0OEkFZ4wuat8WTaMN dOkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=mpkeb86nCt4YUDAKzgfY/W/JicHyTofw1YZI7AZcguo=; b=W4GQOlBsnU1KaNqzOLrCjTsx1cVtKaQQDIjg78DhUyuKga2lrIEOF+kNRP9KfmiABm tyH2kT8fgJD2pOuqd/rmvYUR0neN+WiiVvJZ5zgIKtNdxVrDbiBEV0rZw8a4dw60RS0p 31xOa6ZxXP568/pS1fh7oGiIIMboisJ4mC/Bl1nJtQpnJDt7awbiTWZVAUIvpHeX/GGw tUD25d2epj7d9pqHg5daX7FnJZDmxUSJ3VfJ1yiFz7edHQlj3AXIpyPW0LMnuziCfQ08 ZlJld8Y3FEBG7+SNWWCeasXUzOq0xMtS3647iJ+E3rgD0GgVhYjtEOtx0pZaiLjSR32S K8wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="Yg4Hs4z/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w8si775050jaw.8.2021.05.26.16.52.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 16:52:54 -0700 (PDT) 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=fail header.i=@linaro.org header.s=google header.b="Yg4Hs4z/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3KX-0006jB-RV for patch@linaro.org; Wed, 26 May 2021 19:52:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FJ-0005c4-Bu for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:29 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:46992) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FC-0004V2-Q9 for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:29 -0400 Received: by mail-pj1-x1031.google.com with SMTP id pi6-20020a17090b1e46b029015cec51d7cdso1272777pjb.5 for ; Wed, 26 May 2021 16:47:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mpkeb86nCt4YUDAKzgfY/W/JicHyTofw1YZI7AZcguo=; b=Yg4Hs4z/XzZXsrOsVa3KiNKOzgy/3jAsZ8Ujh8Z+su1RkMXvKXV5/pVQ7cQhX44tb2 ohq5tgetdDVfQ5xCDHjhmheix4fUryCyN340W8DQNmhUxLuNjHdXgeUBb5pZ91Y8v44E JnmUsq+OFD3/3QH/IVMk5qpg3MXsPRWFqL/LUx4CSUBOnt/KnSz796E+PkPbw0meDoMp RDnxZuD7i/ZmcWF/jprdz4GVnYt957ebZ5Esh8VLRMd+qLEeJLRPyxi2zZ/tCPo+lchX ZCflVSLjxUD85pwVTaBt5rmeS19/Nkr9Lk8jk1THzk6nZGVvunnQ8Qvq23smVZilIWue +9bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mpkeb86nCt4YUDAKzgfY/W/JicHyTofw1YZI7AZcguo=; b=hGujgCa61953D1P9DW2m9A6PKN/pw/I1J1NlYaJHS6Sn7OZS6kAu87JURTWxsT9+cg FsyRn41f6fnmZ3R039yW+0nDY/NR6PKm0N4MhWfvxLI15o3XXIEQ8v8TSB17uc6usecJ KbnHo+WGcBAtCjGzyuhP2xejJj3M+zRi8UdjJTIjECSwPxu+0DvDS/Iz80zFFcZGwG6A CX5v1CWbbo5fzWoSODbWprLAflGykThxqCpPLMRvuve9TmE2lUroNkFb8xSHRsSHJ+3j MAnwj+xfdvw00hhHC5buqgsTpaeZOG3pq5GKSJxWVepIW3KcsKMSiXHfVOlPEuR2ecwa S3XA== X-Gm-Message-State: AOAM530d1sbwgMQ8+JbzNdY2o0g72h9bqU9Ni9MJBq4AAfSuytsyTYi2 HbUqO1MlgsBz830WI2Rlazo2KVQ6jHs49A== X-Received: by 2002:a17:90b:341:: with SMTP id fh1mr707193pjb.136.1622072840374; Wed, 26 May 2021 16:47:20 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 09/31] replay: fix watchpoint processing for reverse debugging Date: Wed, 26 May 2021 16:46:48 -0700 Message-Id: <20210526234710.125396-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Pavel Dovgalyuk Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Pavel Dovgalyuk This patch enables reverse debugging with watchpoints. Reverse continue scans the execution to find the breakpoints and watchpoints that should fire. It uses helper function replay_breakpoint() for that. But this function needs to access icount, which can't be correct in the middle of TB. Therefore, in case of watchpoint, we have to retranslate the block to allow this access. Signed-off-by: Pavel Dovgalyuk Message-Id: <162072430303.827403.7379783546934958566.stgit@pasha-ThinkPad-X280> Signed-off-by: Richard Henderson --- softmmu/physmem.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.25.1 diff --git a/softmmu/physmem.c b/softmmu/physmem.c index e1da81ed2f..1c8717684a 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -904,6 +904,16 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, if (watchpoint_address_matches(wp, addr, len) && (wp->flags & flags)) { if (replay_running_debug()) { + /* + * replay_breakpoint reads icount. + * Force recompile to succeed, because icount may + * be read only at the end of the block. + */ + if (!cpu->can_do_io) { + /* Force execution of one insn next time. */ + cpu->cflags_next_tb = 1 | CF_LAST_IO | curr_cflags(cpu); + cpu_loop_exit_restore(cpu, ra); + } /* * Don't process the watchpoints when we are * in a reverse debugging operation. From patchwork Wed May 26 23:46:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448374 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp16438jac; Wed, 26 May 2021 17:00:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx86hvxo/+ssQVmXPn2Ma0fONKq9oyqJYSUnMV49XMcF9WmXfbyJacr+vixrBCY7pBEzwxP X-Received: by 2002:a0c:c709:: with SMTP id w9mr758095qvi.37.1622073600555; Wed, 26 May 2021 17:00:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073600; cv=none; d=google.com; s=arc-20160816; b=pCaDZwc0Q5oauBq8LmQ+x/p9oLSpdCRq5OGjVHOi2hpfYXl1zaCeyzBFBL7yFXXutx lc5xZIkCnEwh/itaUaBcuXmfHTJSVKvM2yHAVGT18pyKOhH8dEdA7UFu+czNd55MrFQI lGjLVRsNvRkSrzcQF2Ppgs3wrd/1HIGpqIjcjrTlD8A8UXPyUx3bPWAicpWOGZQtP/Uk JWl4/BKiPdqIzUcdA+QrHG+vE+0F0rJUbYqy88qeOWjrK17RIjvbxpGXEXXbkmRU1x4n /58o+lJ+D25a3PKyro4KqBVZfIKICzp1n0BpOR5Iy9wTXu/o9taqQRgnPx8sR3O3lBOH K6Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=+yWYtAyvKHCLBY3UydOHOFHk7QNzbfv/DnodNJ6hJsw=; b=Obfi/rNZ1ak5OMw19HvZgVbaefbThdHlrU9tMHs1UiSADias3ISJZGaopiEy2B4Uy5 VW8n7RA6Ix3qGWp71V88VdnbdnK4/rCRcfF8btKr+w1NeRpVth0D6IZz4nQc5Q7FMPZm jiKEPEGFWcnXEUpUdDT5GXbhUtYFqPWco9N4j3eSRDb6ShkO4Y0Arhx7av6yEP3UHnSv 3wjGEDq+8+/oKq0tm1VNtx/ZPHOWYxj86cmBQnYyKbpgaHUr97SLKP8nFLUgN96SWZSF PQDOY+BETImK4aaMNrN35TfZyRw22cnGki5TH7WCDhyF+BpzSfvUoEEU5leb8IvGl6aA EGoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T9htAXoy; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 10si423679qvt.203.2021.05.26.17.00.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 17:00:00 -0700 (PDT) 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=T9htAXoy; 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 Received: from localhost ([::1]:33108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3RQ-0003op-0S for patch@linaro.org; Wed, 26 May 2021 20:00:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FJ-0005d8-Vu for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:29 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:37769) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FC-0004V7-QJ for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:29 -0400 Received: by mail-pg1-x532.google.com with SMTP id t193so2301231pgb.4 for ; Wed, 26 May 2021 16:47:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+yWYtAyvKHCLBY3UydOHOFHk7QNzbfv/DnodNJ6hJsw=; b=T9htAXoysDPLNgWWegWXonbElMenSa5Ov3ente2rThCG8D434TFOB+k+x4f6WbGahw BOa/HLUe+uFExziWvFvm0hSWIQi55CDPZYXFfrV1ohfqxrmX4r6oJAL0irVTAYUXGCnk UUqpStTjdzmui6EhPsTO9Mj7lDSBSyItHmGS6ijsAWq5XKG950pFtt3U08b5avI+BOaX TgZxKUpHr+no76oZttO+6nBvDVcjGb9O3KRyyuJlmg0lEA9/q8i525ojQVGL5Kf2otY/ wlsqgqA/TF4s+SlIg9DsH8JiCLURwUg8QDANO9+sJhc4v4q3hmpT8A09co8P0kOGg4fW sOUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+yWYtAyvKHCLBY3UydOHOFHk7QNzbfv/DnodNJ6hJsw=; b=lRyre20fyq+s9qXneQJ/iYbFRp/l3lZvDEAGPmWaWLcgJ9j2+5klgQ3HB4kaHf7lRH sbHEr2fs4J/OB2DapwbjkBljJLI3RJjMPT0RFFiWuKtq3wedsZ3TfN/CWzq/bGElNRrz gQc2K8SuM1sNA56jeW8bJMFQ5CIC1yuXSgRXBBUiwzJ68+GaZLIf6w+hA4AeCtpbmnmU Q1OPwfvnPh93Bn/e24e4a6gX67/TR0k0mRKtSUwmwO1DW74hTwIk3GwKyMvryA+fZOGn jlcKBJUR+kHW5j1XsZee3QomSuWw2cUejfqJuzXcilERp7WNYgH/EjWNqUdKDcCVyp1D 4LRA== X-Gm-Message-State: AOAM531/GY4pQVO5enXutwJp7fmAjmr/BVUVBBOAcYaO9/XlR8aidGGn dmDwZ7h7+KuKuK9r1BSw7k49yzhCt/CpZA== X-Received: by 2002:a62:7b07:0:b029:2e3:b540:707f with SMTP id w7-20020a627b070000b02902e3b540707fmr908958pfc.59.1622072841195; Wed, 26 May 2021 16:47:21 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 10/31] tcg/aarch64: Fix tcg_out_rotl Date: Wed, 26 May 2021 16:46:49 -0700 Message-Id: <20210526234710.125396-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Yasuo Kuwahara Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Yasuo Kuwahara The last argument of tcg_out_extr() must be in the range 0-31 if ext==0. Before the fix, when m==0 it becomes 32 and it crashes with an Illegal instruction on Apple Silicon. After the fix, it will be 0. If m is in the range 1-31, it is the same as before. Signed-off-by: Yasuo Kuwahara Message-Id: Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c.inc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index f07ba98aa4..5bd366f2d4 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -1291,9 +1291,8 @@ static inline void tcg_out_rotr(TCGContext *s, TCGType ext, static inline void tcg_out_rotl(TCGContext *s, TCGType ext, TCGReg rd, TCGReg rn, unsigned int m) { - int bits = ext ? 64 : 32; - int max = bits - 1; - tcg_out_extr(s, ext, rd, rn, rn, bits - (m & max)); + int max = ext ? 63 : 31; + tcg_out_extr(s, ext, rd, rn, rn, -m & max); } static inline void tcg_out_dep(TCGContext *s, TCGType ext, TCGReg rd, From patchwork Wed May 26 23:46:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448390 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp19426jac; Wed, 26 May 2021 17:04:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQH7hhxBLke9QA8qGVN1kFyqZlBjGNo64cmmyTqPI15KT3X5GWq9/eph8wbRxhrcZA+puc X-Received: by 2002:a05:6122:202a:: with SMTP id l42mr629773vkd.2.1622073850798; Wed, 26 May 2021 17:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073850; cv=none; d=google.com; s=arc-20160816; b=Y7Fx7fiCsvWH0B2EQ2gUO1y2omDJbDUtvoTaaX8bU3tf0Vh3ExbAqbbOFOH27xb/yQ 13p+Pbm8Q19epvt9Vl77wWuqgtB31QHZmXM1kWYdYnjggSyuqMfjl4xccvDSfYdbr59K ZY4hvRy/kdZAWVbY2/hs2OgEa879fSnNNEKomBw2xDwrRpD5jS5Wru2kXVISDMtVl15n saZbS3sAuinS/sGQ7DVEd0gkyzaOFKwPsvyQhF/QrzUwiTYyFitIRwUrmuY1wNJj0r5n KydzsEkNBiBEfzQoOHWpYVWZNmbU8ZiStgVB2/WO7UG6DQRd180l5A4DuIPOLdNR+6oz 9ixQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=6NHbX+q+VShA2Bk5Ng7npHq9zi23MHy7IkVvyiwqk1k=; b=lKbi043azSVI0nWYHzoWpO7FIUMoa3vGo3Rq9dz5BwwuYdo0DIbGkUr+TtNcgKBU54 SwP/L0KXbukz0GW/HLIWL3HwE1tlQ7/wqcxkhVozvjnqWUmimPCjqysX2H6SI1/zaeZJ j2pOuc3k/GHVrT9gmUrx2V2dyz8yJz59F/t2Wx8IwGPe5pL2ykttt0NUy2UeXMVH3r8w 9SpW665cBAclnyD7unX0GSzrToiCAL0wU4Fp/ZIEQWEXkaJQJXni4cOxieLYWS0vPmKN rlVZ0fBZ0meQpJ3IhiqPoOWJTQGWgU+OHKT1B/MMKqlnrARzSu2If9Upzbu/ZTZ2ciNJ j6fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hDygFv5u; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c15si333515vsp.402.2021.05.26.17.04.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 17:04:10 -0700 (PDT) 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=hDygFv5u; 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 Received: from localhost ([::1]:41658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3VS-0001CY-6y for patch@linaro.org; Wed, 26 May 2021 20:04:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FL-0005do-75 for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:31 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:38817) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FG-0004VB-8c for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:30 -0400 Received: by mail-pg1-x533.google.com with SMTP id 6so2296358pgk.5 for ; Wed, 26 May 2021 16:47:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6NHbX+q+VShA2Bk5Ng7npHq9zi23MHy7IkVvyiwqk1k=; b=hDygFv5uMpiv3vzt+5ukCbNv4OuSr0Cvoy9ECWFFZWT6gC3sAZexHp+1I02hqv2FII 47DarLQ9s8i1ku34t0/1bcxTGqo8kNxrLbRAGMOcZWZZ4vJOEd/qENg4MxC9kFm41IyU /e+TCsHHPxY2THK1KBZpIY6NeWURnsS7qAMHHozidxk4jcdl2yHmNLa/c23B9VLP7cWS sOAN3qNKYDgXaDM7mfzF1EMCkRD7nfDkMepxCpUBYCibEzUWTJggoUh04A5A3pfXlMYq aDv7t+SQnI5N/u20/7ImX/WHQ1X70lPPfXm5tKg2OdPgqFwSoWPO+sBLOghfTyeJZHel ojUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6NHbX+q+VShA2Bk5Ng7npHq9zi23MHy7IkVvyiwqk1k=; b=amuc/5zTSP1qyNhcW2Oi5uK8lrzdhrfFRU50jbu1xE5LdKoBbwoB9nAcCwB+QeMbRH 0e3q6C3+PRGwAxlFiBPD8v4DDZEZGWPJSjf+LlETV9YqXz3JApqWJXg1jm377dDwDhR/ pRu4HxOlsAK2A7OUkZc/sFZsOqDn8Amv1CVYcMusJ9mRXCntNTlFD8Qjufu97cwfJ4m2 aC7JmWJfEh1GeI4xcSKMjbJl19YvCu94c6dyUaSpCbXbhRCu3LNIDOz06zFYPKQ6G220 7fAZhSrwj883jlEQXsZjnVSf/h2aPSLKwtkjI993YLwdpl95EYtr6o/Z7dDHtpt3+W5U 0R2Q== X-Gm-Message-State: AOAM532h6C3/oXnKcTKTZShNpvFW9zkw9fF+Q0urFf7+jnFtLUdtAoUJ dkgEjwSkG/xDLTCqWe7mXPJ4ZaPsjgComQ== X-Received: by 2002:aa7:9384:0:b029:2cc:5e38:933a with SMTP id t4-20020aa793840000b02902cc5e38933amr530137pfe.81.1622072842043; Wed, 26 May 2021 16:47:22 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 11/31] cpu: Remove duplicated 'sysemu/hw_accel.h' header Date: Wed, 26 May 2021 16:46:50 -0700 Message-Id: <20210526234710.125396-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-5-f4bug@amsat.org> Signed-off-by: Richard Henderson --- hw/core/cpu.c | 1 - 1 file changed, 1 deletion(-) -- 2.25.1 diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 00330ba07d..919dc3435a 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -34,7 +34,6 @@ #include "hw/qdev-properties.h" #include "trace/trace-root.h" #include "qemu/plugin.h" -#include "sysemu/hw_accel.h" CPUState *cpu_by_arch_id(int64_t id) { From patchwork Wed May 26 23:46:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448335 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2b0d:0:0:0:0 with SMTP id gc13csp6046841ejc; Wed, 26 May 2021 16:54:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLwdgtGj3l8pydSVGEusoXMGI/DaAjiRm/VpdrC23qvaUlUf6oFDSPBKeUX2o0cC0MoBgB X-Received: by 2002:a92:a053:: with SMTP id b19mr682470ilm.284.1622073272121; Wed, 26 May 2021 16:54:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073272; cv=none; d=google.com; s=arc-20160816; b=MX62SN12GXu+2wUrYy1EqRyoDCkN4x0Kfg3kYxqJJMwW8Ytvafq+qn4XjRO2BpDrpP lcBA1NG3cyyvupJa4H0Rzh3HYu9zyyuEOn7ATpjPyarE0aR0L0v5n/f8zDScHIU8KV6I EQ2w2BsgH9wbTcZFOeeTd+wZX4m1Y+fpoSN8MmZakpdOhoh/audfgvBdSNSpcSn7kMrw XBTJB33gRCLAn8j4oSqXofqFgpGZnmXZvJ/iHEyu18qKnzxwosEVXrIdpd3+5jeWycWo FsumX6LGKE6j56nS+QVNHP0+9BjzsTNsU9eehJ/wa3NqGUfN4K2ufbyGzeN9P8nV55h4 OCGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=V0x5rhNypIV83U052hVYT2YxxA7KW5j5yi40Zz65eM0=; b=P7vJ8IQ6wL7hfTuF9TY/jvjOebVYuHEWZ4jeLLLYeizy9PHVrMJdkjRulc3kN/C5dI Th/bHsjmuLRGVzjdV9tQRsFKkKBIUevXQ86/NvLWqDIIiynKu6lINsrfvtgZnFpsaizB W7dgDp7eKRi+VuTtiWP3hxM8d1AiW4djcZB/Zk+zIF5vznaCH7cgpFsxmdtQFosLvn7a 8J0DWMdFvjSZ0eSR46C+2K6dbrJOdnYem+jKvoNrYv826zCjCXtfTqON498K1qui5v+I kN+dq7kIq3bVBY+eUtnZq6h1uB+64HzAgAJXYK+FEJ8nCW029InXyTROJ3TeaHkFFcSh tD7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WGUXzQI5; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i26si556302ion.51.2021.05.26.16.54.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 16:54:32 -0700 (PDT) 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=WGUXzQI5; 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 Received: from localhost ([::1]:44788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3M7-00014h-Ea for patch@linaro.org; Wed, 26 May 2021 19:54:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34892) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FN-0005ia-V2 for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:33 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:43917) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FH-0004VJ-Jc for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:33 -0400 Received: by mail-pg1-x533.google.com with SMTP id e22so2281269pgv.10 for ; Wed, 26 May 2021 16:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V0x5rhNypIV83U052hVYT2YxxA7KW5j5yi40Zz65eM0=; b=WGUXzQI5FvWCdNAJKffI18rImwH4kUi99S9qL/nzqHys9ywXvN5MMVwVAQccXze8/u R6U1QAzFzZW52oUv7qqGAz7ZMQR7oXuN3aBN5PsbXImrXtwDIFDwnhKyDIkVQb3VSqxu TdiPqaO8mWQR995mpXJwEEVLs7kljZqqhvCRaDqjgRTFHLxoj/YSMWUHJ/yhibxu1rVD 1y+GlU0hUatmWM9Xe86M7ITLtJlD2zogbIqbaA2qKphPIzCi/AJhV2HGH1kin1eN16/E 8oSmX0f+2ht6p9dvyz+uMut+nhxeYBoMfCh/TCZRC5RyIZ/JMpKfhmCkKvL4j92Zf2k/ ZElw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V0x5rhNypIV83U052hVYT2YxxA7KW5j5yi40Zz65eM0=; b=Cui1Th90MgRahDmNLfWHkbboJBjLo6shSj9ZbSw4RQsJPFfayfdXVUOJpJU3d32ILm aOMfgIIaXPCnBbYbKFGuaZzwMDd62G+2bZZVrqGYnqrXx4gF9nnBZ7JkvboF257JRxVV Li4kG1p8MaOakv6orC9X6InqovWsdDRPp5k6+iHVlikb0sDIdWBeLzDCsZB0bhHwOqSq uFNXWiEeYuBBGPsUgzVNQK3D7/Ytl0hC2qLWa1w3Xd5s5cb0b4FYXE7X5wquwuQp7sCt xcfYpxS+HBn0wG9MyuWYhBCbUcEX6OSC2lmQHLdoNagGL/egbH+Jmov0kZQhXIisw7aj AKCA== X-Gm-Message-State: AOAM532IXmy13uMCN7wZGlqlTuWxUtNjA3nyZJ9fAy0ioDP82hnbgz4V PzBfJg3wO5/gpq7wQP3qytsXb1Ahf41P8g== X-Received: by 2002:a62:7e41:0:b029:249:287:3706 with SMTP id z62-20020a627e410000b029024902873706mr914470pfc.76.1622072842864; Wed, 26 May 2021 16:47:22 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 12/31] cpu: Split as cpu-common / cpu-sysemu Date: Wed, 26 May 2021 16:46:51 -0700 Message-Id: <20210526234710.125396-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé The current cpu.c contains sysemu-specific methods. To avoid building them in user-mode builds, split the current cpu.c as cpu-common.c / cpu-sysemu.c. Start by moving cpu_get_crash_info(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-6-f4bug@amsat.org> Signed-off-by: Richard Henderson --- hw/core/{cpu.c => cpu-common.c} | 17 ----------------- hw/core/cpu-sysemu.c | 34 +++++++++++++++++++++++++++++++++ hw/core/meson.build | 3 ++- 3 files changed, 36 insertions(+), 18 deletions(-) rename hw/core/{cpu.c => cpu-common.c} (96%) create mode 100644 hw/core/cpu-sysemu.c -- 2.25.1 diff --git a/hw/core/cpu.c b/hw/core/cpu-common.c similarity index 96% rename from hw/core/cpu.c rename to hw/core/cpu-common.c index 919dc3435a..ddddf4b10e 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu-common.c @@ -190,23 +190,6 @@ static bool cpu_common_virtio_is_big_endian(CPUState *cpu) return target_words_bigendian(); } -/* - * XXX the following #if is always true because this is a common_ss - * module, so target CONFIG_* is never defined. - */ -#if !defined(CONFIG_USER_ONLY) -GuestPanicInformation *cpu_get_crash_info(CPUState *cpu) -{ - CPUClass *cc = CPU_GET_CLASS(cpu); - GuestPanicInformation *res = NULL; - - if (cc->get_crash_info) { - res = cc->get_crash_info(cpu); - } - return res; -} -#endif - void cpu_dump_state(CPUState *cpu, FILE *f, int flags) { CPUClass *cc = CPU_GET_CLASS(cpu); diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c new file mode 100644 index 0000000000..f517ef5d46 --- /dev/null +++ b/hw/core/cpu-sysemu.c @@ -0,0 +1,34 @@ +/* + * QEMU CPU model (system emulation specific) + * + * Copyright (c) 2012-2014 SUSE LINUX Products GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see + * + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/core/cpu.h" + +GuestPanicInformation *cpu_get_crash_info(CPUState *cpu) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + GuestPanicInformation *res = NULL; + + if (cc->get_crash_info) { + res = cc->get_crash_info(cpu); + } + return res; +} diff --git a/hw/core/meson.build b/hw/core/meson.build index 59f1605bb0..18f44fb7c2 100644 --- a/hw/core/meson.build +++ b/hw/core/meson.build @@ -13,7 +13,7 @@ hwcore_files = files( 'qdev-clock.c', ) -common_ss.add(files('cpu.c')) +common_ss.add(files('cpu-common.c')) common_ss.add(when: 'CONFIG_FITLOADER', if_true: files('loader-fit.c')) common_ss.add(when: 'CONFIG_GENERIC_LOADER', if_true: files('generic-loader.c')) common_ss.add(when: ['CONFIG_GUEST_LOADER', fdt], if_true: files('guest-loader.c')) @@ -25,6 +25,7 @@ common_ss.add(when: 'CONFIG_SPLIT_IRQ', if_true: files('split-irq.c')) common_ss.add(when: 'CONFIG_XILINX_AXI', if_true: files('stream.c')) softmmu_ss.add(files( + 'cpu-sysemu.c', 'fw-path-provider.c', 'loader.c', 'machine-hmp-cmds.c', From patchwork Wed May 26 23:46:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448334 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2b0d:0:0:0:0 with SMTP id gc13csp6046831ejc; Wed, 26 May 2021 16:54:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpoc6bPdYGZSxbv8KKhQfRj330XnEHc4niUO1G/8dm0nggQusPNW3sXhlRK8JzHH2wXfvB X-Received: by 2002:a25:2208:: with SMTP id i8mr720624ybi.493.1622073271595; Wed, 26 May 2021 16:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073271; cv=none; d=google.com; s=arc-20160816; b=Pj/NTNhLAQtjNNl54eLyK7hvx+wW+4hHl5hoe5IeQMgAOCsOcShceTwJ71W6uqrGyz lpmX1N/lVJ4ZAYehJNycOfX8ZNmL7+LGqMfASFQixOr5aN754WT/gs/UsK99OCbiQKUB Lhnw7vboZxuY6iGq8FixmZEz3TOk9SJj0zsuhzwMeEt1rUWF90KjjAUXdF3QNLX/1Ifn NO3N0t+xs00rV/hRV0DW3P12qYs1GrqcsMJduQytNVQfnYzfoXYihb34roRm2wscWp8q URkqnB0jCpaglgDV6hZ8FLoQvM9VFIxMe+oh3X5QTuo4gh4ZgS9d+LQzmWed1Q8kCfyr ym9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=3ARrLoFwXR1lt0nxT5/xfumNrF8VDU+n1L83DReLwYo=; b=EPmtOElrUMmTAr5K4X/BTY5Ejb4J1ip7Eh3wZ/xLiaClLSetKwsqOUqC0EYNojF7qM pmjudjRpNb9n4JSwDxcwAQ/Ts8JXFxHCJzmwmzJ8lXwidQIBW3823LWddZD1fQ6PplP0 nzqlRMnwCaHax9HIW/cr3hdyyelUvmsSKNQ2guavmnzljDRZpzK4CFlr/tEdlMT+P4Lm 5G9lAGZ8CSfEur2d49DUVB1OJrZ/pIHtJDwZig7VhFjLAdcwGLSZ3qfp+J0HXxSyiqEV H7pFvcEmN3YUlx+ql3hkQhx4sbgadvdDggxYtm1hi2o7rfK1SBss0Q9vaptsi+P1tCay hNIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FZ7pCA+E; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g93si636093ybi.362.2021.05.26.16.54.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 16:54:31 -0700 (PDT) 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=FZ7pCA+E; 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 Received: from localhost ([::1]:47214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3M6-0002ih-V1 for patch@linaro.org; Wed, 26 May 2021 19:54:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34864) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FN-0005gi-5c for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:33 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:34479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FH-0004VO-D2 for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:32 -0400 Received: by mail-pf1-x430.google.com with SMTP id q25so2223040pfn.1 for ; Wed, 26 May 2021 16:47:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3ARrLoFwXR1lt0nxT5/xfumNrF8VDU+n1L83DReLwYo=; b=FZ7pCA+ESF2vvwvDu4UthPFH+5FRV1x0fUOGD+6HGWYMLZoAEsYcU/hEGHpYcgPijK 4RKjPHMqpqd4UmaiwbUqvlAvskj+6pfM4Ka4GSe2JXnId+KWGr/+lE/2pbu/NpSkprIk fTOOowg93nB8k3lBFhh/tBQplYr8g+55LAvZa/mTVHB17IDErpNj5aPKZCQpWktzdipn 8cvthT1Bbr2yCws6ya2FWbHCw+ccfy0FcTUzGULkXY5Yu6rMON5rg2NK/4b5xM+CKxzO ompXO0JGaQMM35+CHUipFiOLo9gQ4DeFuuIy8nYJB+ECK7Cj8lca2R3ZAX8LzbtgwHqO 1IGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3ARrLoFwXR1lt0nxT5/xfumNrF8VDU+n1L83DReLwYo=; b=Cne/9xQkchz5H5G32RIA47qcXiUZprDx7coD1BiVC3xaAYEjHV5hfU1dVC2d9ehSBF yqAG7124NS2YA15bxR2VVeqA3dkhj5x2/yEulMHqvA8s6r685yrZ153LZvn0PBJ8V2uS acjk67nYcOovW+nnNgGg+CaIJgigtTZwbqRPzTPOxF1/1l2QsvuhqOkSsgkRjqN7vR56 646b6iWorS3Ut1SJMo90HBYU+KIFSe7+cRoHjsCZNcekbKnlMCIn+jMnoCKVX9Iud3ZK fPpmltd0ETXj5Y3MmAU8LNBRl9gsMse6heKYygH246UOMQYih3Pamzomss6AsAlb+tZF SW5A== X-Gm-Message-State: AOAM5301h0UuITVORqSSuhifaX/V9lNt3hKBfQ6uPYAEXjjTp5EM9dKP vrrSllQsWAUjCzALeZOJbFS+mCSdblN0LQ== X-Received: by 2002:a65:6549:: with SMTP id a9mr972403pgw.213.1622072843610; Wed, 26 May 2021 16:47:23 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 13/31] cpu: Un-inline cpu_get_phys_page_debug and cpu_asidx_from_attrs Date: Wed, 26 May 2021 16:46:52 -0700 Message-Id: <20210526234710.125396-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé To be able to later extract the cpu_get_phys_page_debug() and cpu_asidx_from_attrs() handlers from CPUClass, un-inline them from "hw/core/cpu.h". Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-7-f4bug@amsat.org> Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 33 ++++----------------------------- hw/core/cpu-sysemu.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 29 deletions(-) -- 2.25.1 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index d45f78290e..df49528785 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -586,18 +586,8 @@ void cpu_dump_statistics(CPUState *cpu, int flags); * * Returns: Corresponding physical page address or -1 if no page found. */ -static inline hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, - MemTxAttrs *attrs) -{ - CPUClass *cc = CPU_GET_CLASS(cpu); - - if (cc->get_phys_page_attrs_debug) { - return cc->get_phys_page_attrs_debug(cpu, addr, attrs); - } - /* Fallback for CPUs which don't implement the _attrs_ hook */ - *attrs = MEMTXATTRS_UNSPECIFIED; - return cc->get_phys_page_debug(cpu, addr); -} +hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, + MemTxAttrs *attrs); /** * cpu_get_phys_page_debug: @@ -609,12 +599,7 @@ static inline hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, * * Returns: Corresponding physical page address or -1 if no page found. */ -static inline hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr) -{ - MemTxAttrs attrs = {}; - - return cpu_get_phys_page_attrs_debug(cpu, addr, &attrs); -} +hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); /** cpu_asidx_from_attrs: * @cpu: CPU @@ -623,17 +608,7 @@ static inline hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr) * Returns the address space index specifying the CPU AddressSpace * to use for a memory access with the given transaction attributes. */ -static inline int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs) -{ - CPUClass *cc = CPU_GET_CLASS(cpu); - int ret = 0; - - if (cc->asidx_from_attrs) { - ret = cc->asidx_from_attrs(cpu, attrs); - assert(ret < cpu->num_ases && ret >= 0); - } - return ret; -} +int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs); #endif /* CONFIG_USER_ONLY */ diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c index f517ef5d46..fe90dde868 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -22,6 +22,38 @@ #include "qapi/error.h" #include "hw/core/cpu.h" +hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, + MemTxAttrs *attrs) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + + if (cc->get_phys_page_attrs_debug) { + return cc->get_phys_page_attrs_debug(cpu, addr, attrs); + } + /* Fallback for CPUs which don't implement the _attrs_ hook */ + *attrs = MEMTXATTRS_UNSPECIFIED; + return cc->get_phys_page_debug(cpu, addr); +} + +hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr) +{ + MemTxAttrs attrs = {}; + + return cpu_get_phys_page_attrs_debug(cpu, addr, &attrs); +} + +int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + int ret = 0; + + if (cc->asidx_from_attrs) { + ret = cc->asidx_from_attrs(cpu, attrs); + assert(ret < cpu->num_ases && ret >= 0); + } + return ret; +} + GuestPanicInformation *cpu_get_crash_info(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); From patchwork Wed May 26 23:46:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448522 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp22268jac; Wed, 26 May 2021 17:08:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOb/oWFlxgJlsuhUJYoL9TwGWMK7P49wQQsm5mtMuGniwUy52Zd4gwJ3sAm8Qi5a80Rzjw X-Received: by 2002:a1f:280e:: with SMTP id o14mr392456vko.19.1622074090842; Wed, 26 May 2021 17:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622074090; cv=none; d=google.com; s=arc-20160816; b=sbiGEl+lxwH7lyFYyve/ETYSY+4fbnJhcvP4siPKfKNImtkBxH4I98SkfneI1bMApp q1RflAkCieYYx2m6lxsp7s8b6hVra5J/tZIrpWdHkmX36o/t5QMe7MCncCASA7voXrQo rhMkLNekv1X2qYgDhYw7+YT9IDhAKO+/681jRaeyYYNnmyAA5AV94vd7rQ+nP9lP0/rG pHsQbpKTTmL2lqaWQO3gtRCrB3UzAOb3tYqHqP3xWvfRdAPfAW5qR3+IOmxoZ4Ukp3cP LqNGyR2g9odd1PuJXPmb9yTEksoI1R1LOHHPlA3vdpUZ4ZNg1RU7kMjSkd7Q6YVuIYu9 oNxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=S7KbakECIlRBEW9AV5a5Z5Z05otVIbkvglZTbFFM7hc=; b=b1fHmTspph5LVkV/8m4rrttqLSRJ0JeI6nfCpSMrJLQOocZRNvnv9uDxr5Uo/D52B2 SH7CNbKYvQLuToAz9cDXCtbNk4+1fjQlzlU/82n63EkDA8Aq6PHOqJUO7n4o7MzN14Eg FFxJ2CzKG8GwtDYf4KwS2NnsVeziNifOky9L83T/mKSYIjcyOEuxb7yBSckBjJULwF49 H44KZiYL3Fq43kCmraafX+eBWkbjDbDdEPy/25VuQISLviF76xGgwkGs9f7+K8+7fbyC 6nNS/Zn2vcmBxeK2IkB1PdkUFqrJN4sXqqPVnW6JEzaH42VplPc6aD0gL5TTRS9zjwuC zgjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ux3Zngik; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y27si331616vsi.379.2021.05.26.17.08.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 17:08:10 -0700 (PDT) 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=ux3Zngik; 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 Received: from localhost ([::1]:48210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3ZK-0005hP-7D for patch@linaro.org; Wed, 26 May 2021 20:08:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34840) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FM-0005eV-9a for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:32 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:34697) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FG-0004VR-AJ for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:31 -0400 Received: by mail-pl1-x62a.google.com with SMTP id e15so1431086plh.1 for ; Wed, 26 May 2021 16:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S7KbakECIlRBEW9AV5a5Z5Z05otVIbkvglZTbFFM7hc=; b=ux3ZngikvLAmLJ62fYLZsH9M4yHr/TSE6iQmGrTQu3W0bQpPqx0vB9kpiXrcxrnNXH ibgpX0JsTdPGvgNbIfBCX92ZF5RETfpN3XjAy8qw8J4J3fS1VB2GGAFEO/i1m6y27V9X VXXp10V6Y57xRawoDvsv7hacZ9u7Bv52wiZ7bsDeHOF6FIpC9LY8Urb7w4J3Lx5fZP/0 uHvFmlHNunLiv+QCYrq7Vj8oOVUlZVeFH7AxsHPz9aAD48mD4yFPOvukvPQWfYZNu9v7 LgJEpS8/PCVHNK3kBtKnXw8UA64719CC+moNf7GcUkKbSZlBCLPWTQzp+ygfxowin8bO aB8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S7KbakECIlRBEW9AV5a5Z5Z05otVIbkvglZTbFFM7hc=; b=t+2J8ASLOlX7XXNvlTbqjSMT/uiqyOUl451fiBIUeu4ezBHGsBg8V+WSMe1qH/5xnf 42WHHc78VyhyMGQfKR1Tjni4V0RqmmVgSaqV/wAS+V9LmpO+RUk4evBympJ1EgiRrBX8 thgApZf27kp/inVbtI3jAC0FR1AdjRwVxB2Dp7NQsJIMocendxwkY8KWoQnO9JXbZlxE 6/bvDcIrEutRoOEzVbIrA+A6qVAczI/6o29kdzs3D2/jK80j3/WXOTqVsLKXZ+4z25Vo 4a9Bc81W8vK9gdql/Fipa1sPqZsSzEzRqhK32rUWawyeYJXawToCrO2MzHB3Y7RTsBk2 +CdA== X-Gm-Message-State: AOAM532yu7Ui/fkK4G/qU8EwTtUTA+1RJMqpD+kNpE2BY4pHVKZ4Jf3H U+gQ6l/T5dx5bwTc31iR1RoPIMdLfrMDIQ== X-Received: by 2002:a17:90a:1150:: with SMTP id d16mr700234pje.180.1622072844283; Wed, 26 May 2021 16:47:24 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 14/31] cpu: Introduce cpu_virtio_is_big_endian() Date: Wed, 26 May 2021 16:46:53 -0700 Message-Id: <20210526234710.125396-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Introduce the cpu_virtio_is_big_endian() generic helper to avoid calling CPUClass internal virtio_is_big_endian() one. Similarly to commit bf7663c4bd8 ("cpu: introduce CPUClass::virtio_is_big_endian()"), we keep 'virtio' in the method name to hint this handler shouldn't be called anywhere but from the virtio code. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-8-f4bug@amsat.org> Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 9 +++++++++ hw/core/cpu-common.c | 6 ------ hw/core/cpu-sysemu.c | 10 ++++++++++ hw/virtio/virtio.c | 4 +--- 4 files changed, 20 insertions(+), 9 deletions(-) -- 2.25.1 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index df49528785..d96ff4dace 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -610,6 +610,15 @@ hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); */ int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs); +/** + * cpu_virtio_is_big_endian: + * @cpu: CPU + + * Returns %true if a CPU which supports runtime configurable endianness + * is currently big-endian. + */ +bool cpu_virtio_is_big_endian(CPUState *cpu); + #endif /* CONFIG_USER_ONLY */ /** diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index ddddf4b10e..9d73c9a28c 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -185,11 +185,6 @@ static int cpu_common_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg) return 0; } -static bool cpu_common_virtio_is_big_endian(CPUState *cpu) -{ - return target_words_bigendian(); -} - void cpu_dump_state(CPUState *cpu, FILE *f, int flags) { CPUClass *cc = CPU_GET_CLASS(cpu); @@ -388,7 +383,6 @@ static void cpu_class_init(ObjectClass *klass, void *data) k->write_elf64_note = cpu_common_write_elf64_note; k->gdb_read_register = cpu_common_gdb_read_register; k->gdb_write_register = cpu_common_gdb_write_register; - k->virtio_is_big_endian = cpu_common_virtio_is_big_endian; set_bit(DEVICE_CATEGORY_CPU, dc->categories); dc->realize = cpu_common_realizefn; dc->unrealize = cpu_common_unrealizefn; diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c index fe90dde868..078e1a84a5 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -54,6 +54,16 @@ int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs) return ret; } +bool cpu_virtio_is_big_endian(CPUState *cpu) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + + if (cc->virtio_is_big_endian) { + return cc->virtio_is_big_endian(cpu); + } + return target_words_bigendian(); +} + GuestPanicInformation *cpu_get_crash_info(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index e02544b2df..ab516ac614 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1972,9 +1972,7 @@ static enum virtio_device_endian virtio_default_endian(void) static enum virtio_device_endian virtio_current_cpu_endian(void) { - CPUClass *cc = CPU_GET_CLASS(current_cpu); - - if (cc->virtio_is_big_endian(current_cpu)) { + if (cpu_virtio_is_big_endian(current_cpu)) { return VIRTIO_DEVICE_ENDIAN_BIG; } else { return VIRTIO_DEVICE_ENDIAN_LITTLE; From patchwork Wed May 26 23:46:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448340 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp15135jac; Wed, 26 May 2021 16:57:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLVJ4n/FM4YbE+Fd1EF4TFZtBwmiTFubR5vNQ+tNC5LrZqMXc3Vt5NUq2Roe0N+Q2ZjvNI X-Received: by 2002:a05:620a:4e:: with SMTP id t14mr656133qkt.215.1622073448141; Wed, 26 May 2021 16:57:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073448; cv=none; d=google.com; s=arc-20160816; b=YqjVbgayQv9I+aDBDTD5ydaOyz7frEFhBaVjeWWBfzvdSs9ulycA4TxCizPiCeWu+X t30g81m46GCo6rCfC4y0RkP6GlxdREdKnqA+8HuoeTTDCU6hQOnKEhcS5PSRpEmxiDoC z1IFE8qoYdTWkjPnmBe0G1xZ2IVYq1To8kRVZ/JbyOAzY0/NKWHXJ+vxipbWp2PQyq4g SgxXvDRptPdbJktFwmZsTtcV0Qw/mQxIuHyyRRAXy136LfGQ6c2+9/MDCRA5jgz2HLqL ixlQMBYLq3ibGRCkwoUmZ3DmuBXjXhQxxUk8aKGpnvrjSXOc0qiYBzQZRqOZaa7GAiES 8DJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=vw5nnEy/H9F7HNJ5jVqUFe/PGYkuz9b7FFSO4MqaxNw=; b=y0AEQuEN2rxmK/hFvvoDJ8vNBOUfohLvgfE8Phcx0zvl5GPeeaLu7FTwj/j/3RYW4m VvXN/pmUGwly1fexlSfILj99If2ICCw5FmnofQ+b3xCT4c813ws32Iee/KSPQN7U7Cct xn3LNmhPrbcpdhMjA58YeSTs5dgsluCCVz0zMiQ0ZzQbN+j3hxYK64g/ovWsH8vppYz7 B+vglsg2n8c1mHGesW6gd+UxTys5fLjkP9LC09UAlHale8G3uqruoKYe/SbAKZrodkei UF9io60hLS0rlGOUY8I/TPUMfpkQa4oHeL/hF8ulK3xiCRDToR6QDDlgg9d0dyUR+K82 4jAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OTiHklgG; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k17si256002qkk.208.2021.05.26.16.57.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 16:57:28 -0700 (PDT) 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=OTiHklgG; 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 Received: from localhost ([::1]:55784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3Ox-0008WR-Ee for patch@linaro.org; Wed, 26 May 2021 19:57:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FN-0005hT-GA for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:33 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:33543) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FH-0004VZ-Do for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:33 -0400 Received: by mail-pf1-x42d.google.com with SMTP id f22so2239546pfn.0 for ; Wed, 26 May 2021 16:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vw5nnEy/H9F7HNJ5jVqUFe/PGYkuz9b7FFSO4MqaxNw=; b=OTiHklgG5s1C4tX5RpKp6V2Ei1y4wG3+MdQBhoGZcwQggAp/LayKJ7wyeqe+dMmyPa j5Bl4T5HxeRKI1lj+a3ENpEn4WZ61HINaWFqOkG1ehobPXS9axs0uj66HZ2hP5kz4D4G vYOrpReF9yxDQ2GvNOvweawVhbtMUKkV9h6g5L56nYqH7DMHTlx7SOaL40ufE4vVKLkf +LJTuqWc851W4gqcH8myYZga+au/BoDfAc6EqaDhtA8tJB9AsMlg6l2CIqUFJSQEufHs Brbd01PNUxJjOeKPxqZmcVzgfYi3OHZstCiJMzn2ZAb0zke35+O0nBcj8tJOqB+ZipHd UOmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vw5nnEy/H9F7HNJ5jVqUFe/PGYkuz9b7FFSO4MqaxNw=; b=U3A/+RB3aDqvtgNFFJBGGMgHsVkO7I4tYNKyFjSF9HKCsp9NaYvLKGhSnjoEisKCp7 212rY8wca/Npfy6Qt0Ckp7t29bI9cobwN65gHJ3O8xa6568mLROpilvvT6roLFvgCQqP 8q4QLS0zmeZ7lnJAYRhgqphzfdhUigz/eduXXNpHhfJZW0NdXF+gseJjpmWqWhmbmkpC CGk4I3SX3hj+F2aJeZNhxU4U8IMbRiXXsplsFeJxQ2lafXO+N/6nxTxKwur8Rnkl29KT 9/LwAYBaMxn24yD0aJElAS57CcYHLQzQmbhoblyygHWR9ZMQgpngX/SqRqf3wYehw2FM 0ofQ== X-Gm-Message-State: AOAM533f2Bym3lnjhZfPWXs2gU/lM0KPELgm1IInZUdxRnfk/7OmsW83 /utirdXk9irUqjBVLaEXpNjOzjaJEO397g== X-Received: by 2002:a65:625a:: with SMTP id q26mr961775pgv.311.1622072845044; Wed, 26 May 2021 16:47:25 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 15/31] cpu: Directly use cpu_write_elf*() fallback handlers in place Date: Wed, 26 May 2021 16:46:54 -0700 Message-Id: <20210526234710.125396-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé No code directly accesses CPUClass::write_elf*() handlers out of hw/core/cpu.c (the rest are assignation in target/ code): $ git grep -F -- '->write_elf' hw/core/cpu.c:157: return (*cc->write_elf32_qemunote)(f, cpu, opaque); hw/core/cpu.c:171: return (*cc->write_elf32_note)(f, cpu, cpuid, opaque); hw/core/cpu.c:186: return (*cc->write_elf64_qemunote)(f, cpu, opaque); hw/core/cpu.c:200: return (*cc->write_elf64_note)(f, cpu, cpuid, opaque); hw/core/cpu.c:440: k->write_elf32_qemunote = cpu_common_write_elf32_qemunote; hw/core/cpu.c:441: k->write_elf32_note = cpu_common_write_elf32_note; hw/core/cpu.c:442: k->write_elf64_qemunote = cpu_common_write_elf64_qemunote; hw/core/cpu.c:443: k->write_elf64_note = cpu_common_write_elf64_note; target/arm/cpu.c:2304: cc->write_elf64_note = arm_cpu_write_elf64_note; target/arm/cpu.c:2305: cc->write_elf32_note = arm_cpu_write_elf32_note; target/i386/cpu.c:7425: cc->write_elf64_note = x86_cpu_write_elf64_note; target/i386/cpu.c:7426: cc->write_elf64_qemunote = x86_cpu_write_elf64_qemunote; target/i386/cpu.c:7427: cc->write_elf32_note = x86_cpu_write_elf32_note; target/i386/cpu.c:7428: cc->write_elf32_qemunote = x86_cpu_write_elf32_qemunote; target/ppc/translate_init.c.inc:10891: cc->write_elf64_note = ppc64_cpu_write_elf64_note; target/ppc/translate_init.c.inc:10892: cc->write_elf32_note = ppc32_cpu_write_elf32_note; target/s390x/cpu.c:522: cc->write_elf64_note = s390_cpu_write_elf64_note; Check the handler presence in place and remove the common fallback code. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-9-f4bug@amsat.org> Signed-off-by: Richard Henderson --- hw/core/cpu-common.c | 63 -------------------------------------------- hw/core/cpu-sysemu.c | 44 +++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 63 deletions(-) -- 2.25.1 diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 9d73c9a28c..5913ffe22b 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -116,65 +116,6 @@ void cpu_exit(CPUState *cpu) qatomic_set(&cpu->icount_decr_ptr->u16.high, -1); } -int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu, - void *opaque) -{ - CPUClass *cc = CPU_GET_CLASS(cpu); - - return (*cc->write_elf32_qemunote)(f, cpu, opaque); -} - -static int cpu_common_write_elf32_qemunote(WriteCoreDumpFunction f, - CPUState *cpu, void *opaque) -{ - return 0; -} - -int cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu, - int cpuid, void *opaque) -{ - CPUClass *cc = CPU_GET_CLASS(cpu); - - return (*cc->write_elf32_note)(f, cpu, cpuid, opaque); -} - -static int cpu_common_write_elf32_note(WriteCoreDumpFunction f, - CPUState *cpu, int cpuid, - void *opaque) -{ - return -1; -} - -int cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu, - void *opaque) -{ - CPUClass *cc = CPU_GET_CLASS(cpu); - - return (*cc->write_elf64_qemunote)(f, cpu, opaque); -} - -static int cpu_common_write_elf64_qemunote(WriteCoreDumpFunction f, - CPUState *cpu, void *opaque) -{ - return 0; -} - -int cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu, - int cpuid, void *opaque) -{ - CPUClass *cc = CPU_GET_CLASS(cpu); - - return (*cc->write_elf64_note)(f, cpu, cpuid, opaque); -} - -static int cpu_common_write_elf64_note(WriteCoreDumpFunction f, - CPUState *cpu, int cpuid, - void *opaque) -{ - return -1; -} - - static int cpu_common_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg) { return 0; @@ -377,10 +318,6 @@ static void cpu_class_init(ObjectClass *klass, void *data) k->has_work = cpu_common_has_work; k->get_paging_enabled = cpu_common_get_paging_enabled; k->get_memory_mapping = cpu_common_get_memory_mapping; - k->write_elf32_qemunote = cpu_common_write_elf32_qemunote; - k->write_elf32_note = cpu_common_write_elf32_note; - k->write_elf64_qemunote = cpu_common_write_elf64_qemunote; - k->write_elf64_note = cpu_common_write_elf64_note; k->gdb_read_register = cpu_common_gdb_read_register; k->gdb_write_register = 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 078e1a84a5..7f3a357494 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -54,6 +54,50 @@ int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs) return ret; } +int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu, + void *opaque) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + + if (!cc->write_elf32_qemunote) { + return 0; + } + return (*cc->write_elf32_qemunote)(f, cpu, opaque); +} + +int cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu, + int cpuid, void *opaque) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + + if (!cc->write_elf32_note) { + return -1; + } + return (*cc->write_elf32_note)(f, cpu, cpuid, opaque); +} + +int cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu, + void *opaque) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + + if (!cc->write_elf64_qemunote) { + return 0; + } + return (*cc->write_elf64_qemunote)(f, cpu, opaque); +} + +int cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu, + int cpuid, void *opaque) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + + if (!cc->write_elf64_note) { + return -1; + } + return (*cc->write_elf64_note)(f, cpu, cpuid, opaque); +} + bool cpu_virtio_is_big_endian(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); From patchwork Wed May 26 23:46:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448360 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp15382jac; Wed, 26 May 2021 16:57:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVcL9vUkGwonvTVicrXKbLkg9I3vzQZrhSHcGjBFSoqGb6FA2XxqUrezpoZrCmv11nca+I X-Received: by 2002:ac8:5fc1:: with SMTP id k1mr662873qta.275.1622073479373; Wed, 26 May 2021 16:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073479; cv=none; d=google.com; s=arc-20160816; b=cQkCLvS12HJd9BVAd9HxNnLsxX7DPM8UMmXCQUtbiD598uG6G0fuS2a7MBzee3kUUM e2zmhyeIdNlktsmMCqZXEBlQysvHOmJdyEsa4JmIX/FhbvTjPnJvTIGrDEAj/u6wQOjv D/x4TySmIRhuetn5T9Z6AGZGM+GcWkAefzODMST/sH2xhhOythEF+FFLjCOG1Xx4LY2f MKmEKq7ShIR1jOf0+MGPeNu+TTW7frWO7ex6JP6EqeAklhoock9j3w970Glp1OE76W12 J5umNe6LYcYUMY8aT1yEL5Ii8dLQJ72VQLzjxV6IvW9+jY5zHbywnH7PG/u9Y9fyz8d2 gH9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=GkrUlbYQvGIINdckDDsYyRJMGvt/rK6bUqzfCARWGa8=; b=uAiZEtxA3kGLmMxBTor8tG5NI3aSlXaOreWBR+J/ZjLqR0cylimRjhvK1PIX0FkJlG Eh0EcP82KuvMp9IuvQCzr3F0p4n4/a6zs4m9DyFTKQm1Tzz5EMbnAVyLSVBhGsTGznUt E2SU9gATxvv1Dvvd0QbPOkhPJScjdTPnlbFdo8Emda7Q/54xqsvN+hHldUvTtogp38A5 umVErhqggXxmzoTqmMVUxU0fQ4Ruqe0xDIX7p0gllvEJ/TG+W97y0fJJThn3QwTypokA dnw4lj4STzAVkdGhEigNx3qc3fAmck6fvIL14wq/KUKfok6WbQ22V9aIa4D76R7T+mVj liLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iCsNwRvc; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r4si480992qtc.60.2021.05.26.16.57.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 16:57:59 -0700 (PDT) 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=iCsNwRvc; 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 Received: from localhost ([::1]:57668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3PS-0001KL-Qc for patch@linaro.org; Wed, 26 May 2021 19:57:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FM-0005fe-RK for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:32 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:38815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FH-0004Vf-DX for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:32 -0400 Received: by mail-pg1-x530.google.com with SMTP id 6so2296486pgk.5 for ; Wed, 26 May 2021 16:47:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GkrUlbYQvGIINdckDDsYyRJMGvt/rK6bUqzfCARWGa8=; b=iCsNwRvcCioueGeYWNuJsqJSOwa3ScHuIZ4CeFf50nirxzCq/jX7J+G1NnLy1/yY+a 8QVz++voVTDqyOTzar9YNnBkcMAmQJCjyveSGx+4GEQmuj7voXPsIH3iekLD1pPkR+D7 FU6TFAuJOie+NoV1d095RGYkW7hLbUehynDHIyAnwdKymYtVSnSwJdlRTsUYO5gl+51H v5SA1tDQ6nY7LBQHGy6Z4kbi/XhydLUtqZPLqayU4Mv55IYeL0sqGhhCnN/XLofVOnOv Um0bNyMH22GQ0JLRqJK+NvAiMap86GoihFBxzvNXmmgPtAXtDm0/tCJvdD1oW2EKN3Zx c3wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GkrUlbYQvGIINdckDDsYyRJMGvt/rK6bUqzfCARWGa8=; b=cfhoD0eWTfD2wfR+yfMNGThdIggonKbmPCZZOtwvZvetjO8Dihn9fgGMT8XKzrTboW RjrzT8Ap0fBP+teTD/BUpPn3TQXvslxXDp6hcGyS8rJgyDi8S28Vc1MMjxyuO2wDEJbd 4+Y7wmRxSXifO5cnUeyEyMkWAneVvIoSdt1ev2A8viMqBBA3eEOWmyDunCEEb3X3CdW7 uVb81il60nG5aXl3fp/lI9C4ObQ4rOa9q4K8WqNb7fSLQWTXkkPEn5rHI9X4WIEnpwFA mmNxWkEi0DyZ92Oj+KXIZTDpoRgDElHlwEWEJniE8BiMMVeNhSJt1TommzKho3zUG8NG /SNA== X-Gm-Message-State: AOAM532D2UiAAZnvTv6yKP7qPgPMZhzOfyre17nH+k5YFoZqhb651mua /9jksKUaz7spHEdT+U4ri890N52z7KZ82Q== X-Received: by 2002:a63:f749:: with SMTP id f9mr960181pgk.369.1622072845823; Wed, 26 May 2021 16:47:25 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 16/31] cpu: Directly use get_paging_enabled() fallback handlers in place Date: Wed, 26 May 2021 16:46:55 -0700 Message-Id: <20210526234710.125396-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé No code uses CPUClass::get_paging_enabled() outside of hw/core/cpu.c: $ git grep -F -- '->get_paging_enabled' hw/core/cpu.c:74: return cc->get_paging_enabled(cpu); hw/core/cpu.c:438: k->get_paging_enabled = cpu_common_get_paging_enabled; target/i386/cpu.c:7418: cc->get_paging_enabled = x86_cpu_get_paging_enabled; Check the handler presence in place and remove the common fallback code. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-10-f4bug@amsat.org> Signed-off-by: Richard Henderson --- hw/core/cpu-common.c | 13 ------------- hw/core/cpu-sysemu.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 13 deletions(-) -- 2.25.1 diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 5913ffe22b..2aa6b8cffc 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -66,18 +66,6 @@ CPUState *cpu_create(const char *typename) return cpu; } -bool cpu_paging_enabled(const CPUState *cpu) -{ - CPUClass *cc = CPU_GET_CLASS(cpu); - - return cc->get_paging_enabled(cpu); -} - -static bool cpu_common_get_paging_enabled(const CPUState *cpu) -{ - return false; -} - void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list, Error **errp) { @@ -316,7 +304,6 @@ static void cpu_class_init(ObjectClass *klass, void *data) k->parse_features = cpu_common_parse_features; k->get_arch_id = cpu_common_get_arch_id; k->has_work = cpu_common_has_work; - k->get_paging_enabled = cpu_common_get_paging_enabled; k->get_memory_mapping = cpu_common_get_memory_mapping; k->gdb_read_register = cpu_common_gdb_read_register; k->gdb_write_register = cpu_common_gdb_write_register; diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c index 7f3a357494..931ba46354 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -22,6 +22,17 @@ #include "qapi/error.h" #include "hw/core/cpu.h" +bool cpu_paging_enabled(const CPUState *cpu) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + + if (cc->get_paging_enabled) { + return cc->get_paging_enabled(cpu); + } + + return false; +} + hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, MemTxAttrs *attrs) { From patchwork Wed May 26 23:46:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448684 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp24570jac; Wed, 26 May 2021 17:11:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4TXyBXNnfigKJgLeje8oPJ0QLYgwzZ50OLSPPvYVFoM0xOztCZ6OFxQUxJHIPPas+FCCr X-Received: by 2002:a05:6602:3359:: with SMTP id c25mr638718ioz.171.1622074313195; Wed, 26 May 2021 17:11:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622074313; cv=none; d=google.com; s=arc-20160816; b=zW95oGFPMY0Il2l2RoDZw16nvIr52w/817ebBtdCv0agsfp1zgwlwAvuJGS03L0Gle g6oL3lFjg/acfASZnEO86nUDvOF7SsLC15hXbS5gZt4undgpmlS7BV7Zh+4HYqGlyJog nvqm+yak1JGBoK+3Cea7bYYlfQJjIW8LQlkj0HultcXuoI1rYJ9XbsQK8OJev5lMftW9 QED8J5uo39gP3UMjfyfVIoBdg4MV88brp+sq1CGYZYtt4ZhUSlg49MyH4FsJzn0rM+bq IWWu1NAqf+AZM3PMBBU77DE0Zgvmfwc5Cy/GG1Ho8wxVMyzEYafCqwU3fPZ9lhcnJxWC hWuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=WlyMc+K2Pid/BoobYq2w/tlLCLpXHS9PvnSEDevx2XU=; b=c9MuMjVPIe8r63LFAs32zx01GaeWiSXJYE7TfXXQELvxyi+sdjbGDkCh5eC42/UJLH JXOwpkVJewZyggN9QOdVT6S4MFvw0RFGIaM2Yw9KCDGcKU6MiAe7Aezm0Wstm17vH/8d NeYI2lTLHR4XKz2NFMzqtvdtsyFg7TvSO5qfFS24OZT4Lx1jKV05VCXHL2ogsDvsO8rN V4+jzligS0RjhL369nRR9Y/Q39+16r2aN3WwB9s8a6alCXhq0/dGOA53dx7gTp3WsCH8 WJEj7B83tTfX/Do63sojhzbkre+TOgstzr2axIu6Gz+uKWJyJI8zYSry9D1x2Q+gNuv+ 1BPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hobtuQpR; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j3si621490ilo.104.2021.05.26.17.11.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 17:11:53 -0700 (PDT) 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=hobtuQpR; 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 Received: from localhost ([::1]:53888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3cu-0001D0-NY for patch@linaro.org; Wed, 26 May 2021 20:11:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FO-0005kL-HJ for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:34 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:50962) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FH-0004Vm-QN for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:34 -0400 Received: by mail-pj1-x1035.google.com with SMTP id t11so1714373pjm.0 for ; Wed, 26 May 2021 16:47:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WlyMc+K2Pid/BoobYq2w/tlLCLpXHS9PvnSEDevx2XU=; b=hobtuQpRTJhPA00PpqsCUN3Id0E2so7iOrubDvxfKAmb62o3liZXLzdZ2C16L6GS8Y Ih0mm51e+CrYL9whnS0qTuEEm/3tO5C9ZFeszEGULqAKnWOATJlDdtCP3BiaOHKxJ5xv lJefco8cAdAcVopXy7aFXldH1RvtDY5fx/wNrspX7siY87xjnBYBNAeKanQxyebnbiCj qztGzzVC5eaKhcWUlP9fqmbyAgdFNm9q5cxMtVmTBcdBQ+HDENi7/sWXMQuF7zmDhiuP pXCj4jmncgqKF03eEbR629nVGQf+pwxTsA68qCgLfgBz9XXex1kZfvcC+T1W9kCUR71m hv9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WlyMc+K2Pid/BoobYq2w/tlLCLpXHS9PvnSEDevx2XU=; b=ADZHsDiccRFB/FqHSNF2b6KOhJO9mhrTIcKSMku9z/hErlI08b2zJe57G1DNhQmC6s 4tsMnvIKYVTqRf/4VQJdXK+vclQ6Pd9oyjuNrjFbBJfvo5n6XM3KOL3rY7kKBj4di98E rOoaKZVfa57ejRPl5gArnJUInN/svVE605kbLaZhC2+U4x5KzzA06JTsUuOxyR2N0hlH AdiXxdiD//XH4zClppkBI2pOehPjhE79za0CfFpLxkIr+tCu8Om8ydoF9vz3/E23a8lC djhPfYrl4EHIATfNl5AMfPdgwVtwszY61InIJhJR0pnggK3SM/WvLeUGCD8QQA+fNLif sikQ== X-Gm-Message-State: AOAM532Rp7y7bxEv0mC7MBugiOvBZDu9pmKOUZ26DADzhEd4K4xEXjTx JdUtyYchthn2GmcnijwVpilmuTVLFrptqQ== X-Received: by 2002:a17:90a:7306:: with SMTP id m6mr6411532pjk.217.1622072846461; Wed, 26 May 2021 16:47:26 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 17/31] cpu: Directly use get_memory_mapping() fallback handlers in place Date: Wed, 26 May 2021 16:46:56 -0700 Message-Id: <20210526234710.125396-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé 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 = cpu_common_get_memory_mapping; target/i386/cpu.c:7422: cc->get_memory_mapping = x86_cpu_get_memory_mapping; Check the handler presence in place and remove the common fallback code. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-11-f4bug@amsat.org> Signed-off-by: Richard Henderson --- hw/core/cpu-common.c | 16 ---------------- hw/core/cpu-sysemu.c | 13 +++++++++++++ 2 files changed, 13 insertions(+), 16 deletions(-) -- 2.25.1 diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 2aa6b8cffc..9530e266ec 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; } -void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list, - Error **errp) -{ - CPUClass *cc = 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 *data) k->parse_features = cpu_common_parse_features; k->get_arch_id = cpu_common_get_arch_id; k->has_work = cpu_common_has_work; - k->get_memory_mapping = cpu_common_get_memory_mapping; k->gdb_read_register = cpu_common_gdb_read_register; k->gdb_write_register = 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 931ba46354..aa68ca281e 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; } +void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list, + Error **errp) +{ + CPUClass *cc = 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) { From patchwork Wed May 26 23:46:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448686 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp26085jac; Wed, 26 May 2021 17:14:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRuRVNxgOZZ75kuUX48b/oO5kjU8Jk/31MYNGDpukEwwxTnWfp8U2vNYIaeXu7rLPn14H0 X-Received: by 2002:a6b:d103:: with SMTP id l3mr659614iob.159.1622074467838; Wed, 26 May 2021 17:14:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622074467; cv=none; d=google.com; s=arc-20160816; b=Lfr3Dnvx7XOwGXG7WgLZnfqOaelYPRD4g2JiOKZpDJpK7BJqajJJJcK+h8bHKoUzvy plImTnoKG+NTVbS34v5jyX2mvIUMGG8s3Jfx1jdOQoO2oY0Mv4yWj8cZSEd/KVkGOxX7 uaS4/8xY2/rgJa6wNg++vHNboGV0U9Y7cLFWznI2nJ6ksAdVBFvFjUjRboHAlv/BaJ2k 1hOnxMFYrUUUtZ/VS1IcIB/qakNC9dndI2qXXxhD7lN0H4w/k9BFEriyEXGzuDSz/pS3 oYvJq2p7pq4aJH/Fq6atK9+U7aSnhchvMLuw7iUCq+NBspTR2+v9dAqQoeqBa0nAClMG +vnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=e6BEiCbeKFz5loqZtzxI2JeaF9i9lMWYWU5RWY4z+jo=; b=bTsfXn8tozej1X1GcOoROzrb+88CkTn163aBPejrvkQKndGbpf8+Hi33iSPl9lY+iV 98qpqHOPkgAeV/NqvyKDEudOolbFeCwQINO8fT8i3lWFFxjgbFYvw8ybRcG3pg7s1KOC J8QipucIvVdfFQGVIITgu4DXVCZO8vNxFCF50DyQvZkj9ik4aRe1pClcmNzco5ZFaf3N ez+mVDklGoZfwF37zBm0250u9+wsitGuf+uo9amwNl4aHhb2YSdmRnu3X/FCj886+cFX SuNwfFq41wk+OrueqLdurifviSUyr9FogCYFRGWmvy6n4y3oHygu3cQNF4+vTkxaCtL2 l4mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s0ePgidF; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l11si894555jak.61.2021.05.26.17.14.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 17:14:27 -0700 (PDT) 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=s0ePgidF; 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 Received: from localhost ([::1]:58046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3fP-0004AG-7p for patch@linaro.org; Wed, 26 May 2021 20:14:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FO-0005kq-KO for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:34 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:38899) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FI-0004Vz-Kd for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:34 -0400 Received: by mail-pl1-x62b.google.com with SMTP id 69so1422329plc.5 for ; Wed, 26 May 2021 16:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=e6BEiCbeKFz5loqZtzxI2JeaF9i9lMWYWU5RWY4z+jo=; b=s0ePgidFtxmL/mVzo3BVldMMiwsrS76yEBmP2pYhvhZ5B6b1RbTeN3cx2Xyhu7c3Je MGzid/cWrutbXFCDzXDfu0xhnp6vBioRA0t9CHVMkywaBEAPlujNKNUdMIGgydN2ZOxm yRjdsMPCp+mEf5YFLdoJuev0bQvZDN7YrslHKATtCtJMoFIE2dFBN4lUT5LPkXl4WgwA /vyfF8IEnroT2IXi4vjEqo3eLQibcq8cXINQNErmzTIdKEQeZn5RvSIPB9SNmCDI86Ei 7b3mYh97+/UnPgFdvXHqWdb0CfQAvKpPw4BWPGF0s34sD+wigFxyG9CQB/OYeTfdwprs TUHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e6BEiCbeKFz5loqZtzxI2JeaF9i9lMWYWU5RWY4z+jo=; b=giKPYGV61S/qcJWburHxYD0FsU0YjgyQk5LEFTTiADc6CDMLk4flw5jJOIYtXLBqUh hxhMvcMu/YQqQzwhi2rT0kLNGaHewghAPfXN3KhVLdNm22CFsoiC69oD4BXGmaybvZr0 /AFHYje4L9h98+r9AACwo3Yjgfbe+5hord4rbwC5KiEHEYUkaRmH9SP20nomZlMFda/c 8HcIPYRkubZqZqgHl3/ZdYUlzqEkTp1TuLxxaww+NrzdpNprCiEP0o+dKQ8ITj97lBCj a82AeYDPyeTKXXX1DeEUZuK4sF6840/pEUuVfttZPrfwNs3qRXNRSWMk9aSOxtVcBHqD e1VQ== X-Gm-Message-State: AOAM531xigTNOI08S7Eq6dsnR6fYSTThcS6rMXDH2jEeAL9Jj0/DCFkz BYKtwjSUYBpklxfOFWFwPVIOaWBxOtks4A== X-Received: by 2002:a17:90a:fa6:: with SMTP id 35mr685681pjz.186.1622072847280; Wed, 26 May 2021 16:47:27 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 18/31] cpu: Assert DeviceClass::vmsd is NULL on user emulation Date: Wed, 26 May 2021 16:46:57 -0700 Message-Id: <20210526234710.125396-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Migration is specific to system emulation. Restrict current DeviceClass::vmsd to sysemu using #ifdef'ry, and assert in cpu_exec_realizefn() that dc->vmsd not set under user emulation. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-12-f4bug@amsat.org> Signed-off-by: Richard Henderson --- cpu.c | 2 ++ target/sh4/cpu.c | 5 +++-- target/xtensa/cpu.c | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/cpu.c b/cpu.c index 34a0484bf4..6fe4af2797 100644 --- a/cpu.c +++ b/cpu.c @@ -141,6 +141,8 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp) #endif /* CONFIG_TCG */ #ifdef CONFIG_USER_ONLY + assert(qdev_get_vmsd(DEVICE(cpu)) == NULL || + qdev_get_vmsd(DEVICE(cpu))->unmigratable); assert(cc->vmsd == NULL); #else if (qdev_get_vmsd(DEVICE(cpu)) == NULL) { diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index ac65c88f1f..35d4251aaf 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -218,10 +218,12 @@ static void superh_cpu_initfn(Object *obj) env->movcal_backup_tail = &(env->movcal_backup); } +#ifndef CONFIG_USER_ONLY static const VMStateDescription vmstate_sh_cpu = { .name = "cpu", .unmigratable = 1, }; +#endif #include "hw/core/tcg-cpu-ops.h" @@ -257,12 +259,11 @@ static void superh_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_write_register = superh_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = superh_cpu_get_phys_page_debug; + dc->vmsd = &vmstate_sh_cpu; #endif cc->disas_set_info = superh_cpu_disas_set_info; cc->gdb_num_core_regs = 59; - - dc->vmsd = &vmstate_sh_cpu; cc->tcg_ops = &superh_tcg_ops; } diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index 210ef80092..0267571fbd 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -175,10 +175,12 @@ static void xtensa_cpu_initfn(Object *obj) #endif } +#ifndef CONFIG_USER_ONLY static const VMStateDescription vmstate_xtensa_cpu = { .name = "cpu", .unmigratable = 1, }; +#endif #include "hw/core/tcg-cpu-ops.h" @@ -215,9 +217,9 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_stop_before_watchpoint = true; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug; + dc->vmsd = &vmstate_xtensa_cpu; #endif cc->disas_set_info = xtensa_cpu_disas_set_info; - dc->vmsd = &vmstate_xtensa_cpu; cc->tcg_ops = &xtensa_tcg_ops; } From patchwork Wed May 26 23:46:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448687 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp28219jac; Wed, 26 May 2021 17:18:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2K0qasqvNSrJqfzrWfIwUqUB38rNEbyl6P8byUpECOYZ+fxSoGadhdWGTO1qwWk2SAdff X-Received: by 2002:a05:620a:68d:: with SMTP id f13mr788731qkh.31.1622074682099; Wed, 26 May 2021 17:18:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622074682; cv=none; d=google.com; s=arc-20160816; b=DjGTCVQRzRVo/XGSB1lypUaH2dOfY9p/kGvELucDVw2qUKysZszzuxL96TzlRJhaqY 8n6dVch93jFbdNVeo4fN7MHQsc8Dkr4st4JZ9S0cI+tv3I+0CuB4SnTJIamQ0orx5hXm EqtV93ECB0UtBcN++ucL1oFQNy01f0sIufrHt4o7WuxjZj9Gpq9su4zY80u8+tu4uimT wOXGLUzhpI4lM44J8JYelgd+zexX+bDrXEdtkOIuMTSO1xhFd+q1qz6KUgfE9VG3Oda6 O1IbGu294NH6CmgLTsLhVA2vUv0TYHWbGaiDUKQyAqR8erGHPUL1e8uliOIZNryKTkoF 8I9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=YoyKQZ/vbIkEieml6WuQhOVk7AT2oQX9AQbQfT0WBxc=; b=SRVc5YxuDrS0ES5nSLOk6Gx8EwBATvIbTs5ZPqAGBGLxSfjS7GhJd98mIkGpY6TV+S iVoQXDNYbB5wltL1l+JrqF0Rsf1i5dRAleMLRvF8nkBJCJNFO6H6IG6vEbUP7/qQkuph 3VIYL5FGPAg5R868iOtQxYAK7LdhB2YfhGxDpDcRATmyBQzTe2bOA+Na6Ml3xtbfA7yj 1p8eFZJypEV2pYmru88RQezyRqT0B1GikinvQsKZs4O/D4g7ZDLMiPKB3UqcYBK4r3IL oHCMuwuueoW9qzib+Xl+sbOjo1l6x4TbJuWyXCivffKN0muMNT4xcj2Sw6/xQve442yu xhag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tJd3xsKX; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u10si470480qvg.79.2021.05.26.17.18.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 17:18:02 -0700 (PDT) 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=tJd3xsKX; 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 Received: from localhost ([::1]:32888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3ir-0006Qf-FN for patch@linaro.org; Wed, 26 May 2021 20:18:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FP-0005nQ-Bl for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:35 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:40625) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FJ-0004Xh-FJ for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:35 -0400 Received: by mail-pj1-x1030.google.com with SMTP id lr4-20020a17090b4b84b02901600455effdso115598pjb.5 for ; Wed, 26 May 2021 16:47:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YoyKQZ/vbIkEieml6WuQhOVk7AT2oQX9AQbQfT0WBxc=; b=tJd3xsKXxUtyLXmQX47JKl1NxfArTND+Q3DErlz3IobEjlcKKUjvno8cMIvSKjS43A N6ts9Gik2jOfU22TizvRZFgM0ZWbzjPN9TJuRNa9tAOyC5LW7NlAsrYZlJYlfQfeHE8l uTIgWUApD4blkZutcpOOoP1dFBbswG8TRdWYZj/DUzahmdkG7qyraYDc7r1cNq8AOC6q WLwK42tNh3U0Cm8O/BBKNazyRrbytw2POCYuyf6dUAQfIutXjsk6NXzkAUlFxNGeF3QV 1Yp9wyW8wMTihgfKNMETykVY2/OzgfD2cU+WZmFnPJXDMjxb9deFhk4CVqgBI2lVwhXN //zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YoyKQZ/vbIkEieml6WuQhOVk7AT2oQX9AQbQfT0WBxc=; b=SQ26TbWH5hIwfz0h6fy9H7cYek70hVQLnQBgnbZw7WrjEFeJzxfJ5xunnNEsTld7Uh 6oxWcS+XxbZAeuFaWRZS2hZtF3SvbJTuX8Cr6IqNv13BS1ymX0dEOnyHcZUyhUpFjg5I GPfsU13w/agsV8jkc7Rm4bfsybp1i4M1Wz9IZzVuiv/odNc23JITHxw4CxqEXeZKihuv 8CgTsmAgMxmgzklnAzL18fM9MMXpNify6zkPS1mIdXr4wHikf6oaLB30B+e9v8AnbXtI Lxcn9Y9otkmhNS3foX4qk81XT6SPk4alGTldg8h4MhLCToiqBMWNCFpjNpjXBrIC11uT 86YQ== X-Gm-Message-State: AOAM5306iPDo94etuDIRVFjcOEB88o1GFZbsE4WYjBnlmAQ2BNTVtSAI TCww9SR1qJho0W9vifbM9jrDAF13AtcHiw== X-Received: by 2002:a17:90a:4493:: with SMTP id t19mr644587pjg.217.1622072848150; Wed, 26 May 2021 16:47:28 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 19/31] cpu: Rename CPUClass vmsd -> legacy_vmsd Date: Wed, 26 May 2021 16:46:58 -0700 Message-Id: <20210526234710.125396-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Quoting Peter Maydell [*]: There are two ways to handle migration for a CPU object: (1) like any other device, so it has a dc->vmsd that covers migration for the whole object. As usual for objects that are a subclass of a parent that has state, the first entry in the VMStateDescription field list is VMSTATE_CPU(), which migrates the cpu_common fields, followed by whatever the CPU's own migration fields are. (2) a backwards-compatible mechanism for CPUs that were originally migrated using manual "write fields to the migration stream structures". The on-the-wire migration format for those is based on the 'env' pointer (which isn't a QOM object), and the cpu_common part of the migration data is elsewhere. cpu_exec_realizefn() handles both possibilities: * for type 1, dc->vmsd is set and cc->vmsd is not, so cpu_exec_realizefn() does nothing, and the standard "register dc->vmsd for a device" code does everything needed * for type 2, dc->vmsd is NULL and so we register the vmstate_cpu_common directly to handle the cpu-common fields, and the cc->vmsd to handle the per-CPU stuff You can't change a CPU from one type to the other without breaking migration compatibility, which is why some guest architectures are stuck on the cc->vmsd form. New targets should use dc->vmsd. To avoid new targets to start using type (2), rename cc->vmsd as cc->legacy_vmsd. The correct field to implement is dc->vmsd (the DeviceClass one). See also commit b170fce3dd0 ("cpu: Register VMStateDescription through CPUState") for historic background. [*] https://www.mail-archive.com/qemu-devel@nongnu.org/msg800849.html Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Cc: Peter Maydell Message-Id: <20210517105140.1062037-13-f4bug@amsat.org> Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 5 +++-- cpu.c | 12 ++++++------ target/arm/cpu.c | 2 +- target/avr/cpu.c | 2 +- target/i386/cpu.c | 2 +- target/mips/cpu.c | 2 +- target/ppc/cpu_init.c | 2 +- target/riscv/cpu.c | 3 +-- target/s390x/cpu.c | 2 +- target/sparc/cpu.c | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) -- 2.25.1 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index d96ff4dace..1dfb788415 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -122,7 +122,8 @@ struct AccelCPUClass; * 32-bit VM coredump. * @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF * note to a 32-bit VM coredump. - * @vmsd: State description for migration. + * @legacy_vmsd: Legacy state description for migration. + * Do not use in new targets, use #DeviceClass::vmsd instead. * @gdb_num_core_regs: Number of core registers accessible to GDB. * @gdb_core_xml_file: File name for core registers GDB XML description. * @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to stop @@ -177,7 +178,7 @@ struct CPUClass { int (*write_elf32_qemunote)(WriteCoreDumpFunction f, CPUState *cpu, void *opaque); - const VMStateDescription *vmsd; + const VMStateDescription *legacy_vmsd; const char *gdb_core_xml_file; gchar * (*gdb_arch_name)(CPUState *cpu); const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname); diff --git a/cpu.c b/cpu.c index 6fe4af2797..c57f4c302b 100644 --- a/cpu.c +++ b/cpu.c @@ -143,13 +143,13 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp) #ifdef CONFIG_USER_ONLY assert(qdev_get_vmsd(DEVICE(cpu)) == NULL || qdev_get_vmsd(DEVICE(cpu))->unmigratable); - assert(cc->vmsd == NULL); + assert(cc->legacy_vmsd == NULL); #else if (qdev_get_vmsd(DEVICE(cpu)) == NULL) { vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, cpu); } - if (cc->vmsd != NULL) { - vmstate_register(NULL, cpu->cpu_index, cc->vmsd, cpu); + if (cc->legacy_vmsd != NULL) { + vmstate_register(NULL, cpu->cpu_index, cc->legacy_vmsd, cpu); } #endif /* CONFIG_USER_ONLY */ } @@ -159,10 +159,10 @@ void cpu_exec_unrealizefn(CPUState *cpu) CPUClass *cc = CPU_GET_CLASS(cpu); #ifdef CONFIG_USER_ONLY - assert(cc->vmsd == NULL); + assert(cc->legacy_vmsd == NULL); #else - if (cc->vmsd != NULL) { - vmstate_unregister(NULL, cc->vmsd, cpu); + if (cc->legacy_vmsd != NULL) { + vmstate_unregister(NULL, cc->legacy_vmsd, cpu); } if (qdev_get_vmsd(DEVICE(cpu)) == NULL) { vmstate_unregister(NULL, &vmstate_cpu_common, cpu); diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 7aeb4b1381..bf82276611 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1983,7 +1983,7 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) #ifndef CONFIG_USER_ONLY cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug; cc->asidx_from_attrs = arm_asidx_from_attrs; - cc->vmsd = &vmstate_arm_cpu; + cc->legacy_vmsd = &vmstate_arm_cpu; cc->virtio_is_big_endian = arm_cpu_virtio_is_big_endian; cc->write_elf64_note = arm_cpu_write_elf64_note; cc->write_elf32_note = arm_cpu_write_elf32_note; diff --git a/target/avr/cpu.c b/target/avr/cpu.c index 0f4596932b..37a8ebcc86 100644 --- a/target/avr/cpu.c +++ b/target/avr/cpu.c @@ -213,7 +213,7 @@ static void avr_cpu_class_init(ObjectClass *oc, void *data) cc->set_pc = avr_cpu_set_pc; cc->memory_rw_debug = avr_cpu_memory_rw_debug; cc->get_phys_page_debug = avr_cpu_get_phys_page_debug; - cc->vmsd = &vms_avr_cpu; + cc->legacy_vmsd = &vms_avr_cpu; cc->disas_set_info = avr_cpu_disas_set_info; cc->gdb_read_register = avr_cpu_gdb_read_register; cc->gdb_write_register = avr_cpu_gdb_write_register; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index c496bfa1c2..5a1c8ead8e 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6749,7 +6749,7 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->write_elf64_qemunote = x86_cpu_write_elf64_qemunote; cc->write_elf32_note = x86_cpu_write_elf32_note; cc->write_elf32_qemunote = x86_cpu_write_elf32_qemunote; - cc->vmsd = &vmstate_x86_cpu; + cc->legacy_vmsd = &vmstate_x86_cpu; #endif /* !CONFIG_USER_ONLY */ cc->gdb_arch_name = x86_gdb_arch_name; diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 1ad2fe4aa3..eba56ac899 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -561,7 +561,7 @@ static void mips_cpu_class_init(ObjectClass *c, void *data) cc->gdb_write_register = mips_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = mips_cpu_get_phys_page_debug; - cc->vmsd = &vmstate_mips_cpu; + cc->legacy_vmsd = &vmstate_mips_cpu; #endif cc->disas_set_info = mips_cpu_disas_set_info; cc->gdb_num_core_regs = 73; diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 22ecbccad8..668fd141db 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -9305,7 +9305,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_write_register = ppc_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug; - cc->vmsd = &vmstate_ppc_cpu; + cc->legacy_vmsd = &vmstate_ppc_cpu; #endif #if defined(CONFIG_SOFTMMU) cc->write_elf64_note = ppc64_cpu_write_elf64_note; diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 3191fd0082..16510da259 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -638,8 +638,7 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data) cc->disas_set_info = riscv_cpu_disas_set_info; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = riscv_cpu_get_phys_page_debug; - /* For now, mark unmigratable: */ - cc->vmsd = &vmstate_riscv_cpu; + cc->legacy_vmsd = &vmstate_riscv_cpu; cc->write_elf64_note = riscv_cpu_write_elf64_note; cc->write_elf32_note = riscv_cpu_write_elf32_note; #endif diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 64455cf309..7ce425f611 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -516,7 +516,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_write_register = s390_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = s390_cpu_get_phys_page_debug; - cc->vmsd = &vmstate_s390_cpu; + cc->legacy_vmsd = &vmstate_s390_cpu; cc->get_crash_info = s390_cpu_get_crash_info; cc->write_elf64_note = s390_cpu_write_elf64_note; #endif diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index aece2c7dc8..ba497561bf 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -889,7 +889,7 @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_write_register = sparc_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = sparc_cpu_get_phys_page_debug; - cc->vmsd = &vmstate_sparc_cpu; + cc->legacy_vmsd = &vmstate_sparc_cpu; #endif cc->disas_set_info = cpu_sparc_disas_set_info; From patchwork Wed May 26 23:46:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448389 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp17331jac; Wed, 26 May 2021 17:01:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4kZ08OZ2QPgZnjk/cILFVuK9072T+8mZxooUupffg0VLsCeuZ8prDxtqomShKYEL4rLlN X-Received: by 2002:a05:6402:2217:: with SMTP id cq23mr835802edb.29.1622073675279; Wed, 26 May 2021 17:01:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073675; cv=none; d=google.com; s=arc-20160816; b=rf+WpNx9MHYJU2RDYH3efXWdrX/4HrmpxwIAp6RthnuozoidG6dO009prgELKbhr1s lsrNSRESz8ZXHhkGWCrzN/sA3R9PKFrV+95LgYzRT4mx89My8bmVYmhOiE5N+TkNCv4r LmLq/ywg8Kki9/P9Dw4gFkCaHXb6M2CV4U1R+2lRsvHB0YuSB+pOPtp3AoZgXrvrM3iU kfiCgz/E7x4RAOFAcAvo0wseHxq/ogP0DWBi7PA7S5OHn+dtWGCNo0FnyBDnGIp9y4Ui 5c2fQpzsOQGZzbsRvXN4GfM1MHVEREPrut8T7uYcMkRyzK01tkH5s+LDcmKTBFPabnZ/ 4xmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=BW0oJJiLXi4mMD8lNsTsa4jEjRDlHenk7c8JGyBfsms=; b=zD9iZTLBi1QVeVeNZxKdoRBnjtZOz5fi2LDatpYM4cUjIqx/UM8/DO4FXWEaYobDGa xblunjTJP1Ord4/4IiCARPpzoo7ZbZSAWUuqebzLcb5QFEOsMW9mozdTaWI7/NKtW1AQ JY3ZptSRHOL2a4BMFBNNM4Rb8N2s11QQNANK/6bIDErRKYktCmNzCQAYPvHjE/OwBM83 6he0y9UFdwuodopAI7WnPm0NxhYBcQOagQ8eVh8ShyyQC/jC6mwWLPm8SKMHV90gzwR7 o66gS+/dfQndKGkRKs6sIBDJYm6vJ9OvwWjxihDg/XX2UfxqbEqkGH5NkaXOpoLUiCTD mtgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DEEjKRHi; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b10si612178ejj.523.2021.05.26.17.01.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 17:01:15 -0700 (PDT) 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=DEEjKRHi; 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 Received: from localhost ([::1]:38034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3Sc-0007B3-96 for patch@linaro.org; Wed, 26 May 2021 20:01:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FQ-0005qD-Ab for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:36 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:36762) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FJ-0004YE-Tz for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:36 -0400 Received: by mail-pl1-x62b.google.com with SMTP id a7so1425521plh.3 for ; Wed, 26 May 2021 16:47:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BW0oJJiLXi4mMD8lNsTsa4jEjRDlHenk7c8JGyBfsms=; b=DEEjKRHitq+9e+gjaooNQ+uz6zLaSPkFORlVQ0x3iqd6Y8zAookfGaEYrPnTuHbCJ2 vA8PwmkgMn4qxDCF6RhLSjId7fpzk6+ODuqYp2O9xTiaNDqTdr4sq7Ev8iyIh+Wl7yp1 EGFhddtxwN2PlVeqs0+pQqRNB9+PThxhHyBHf6E+OPsMHBZ/sg816ObDwt56Mig4kSC6 iVVRVojlC+TLV0hpGiT61nrIrnsfjGrJwhLOyHNA7yp78Emk4cEuiND+a/7m7UiBTJmQ 4psHfpk5l5btmbdTx4FDD5u3gYe6VOcHXfAQddpPFOOX9SFtmoufkGQCcvkxB+uO5VQH JQOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BW0oJJiLXi4mMD8lNsTsa4jEjRDlHenk7c8JGyBfsms=; b=ojFbpxia+LqbXfvoF0hTkd870b9eWZq6CidWWzUtRH94pfiOjiOFyEZ5+eUeiicb20 wLtp9o4S+MfA4CvXoNUl408tWc9+0ief3/7zTGrD4Sey58AgoybsAd+b1hDy9viqpKDO qnLnJKyhJH+/7WmVAQpQTrNRIBHm5kKo2UAF+PkKsBYd0+QavF9aN9hRDsmbgFOw5nLy C8OdvqJmCNdDmDUgTthz7QZXaiEWlUVbFJAFQU2x+THVi0ji6cgt2kDXG0YkzXqw/yqM FqQdhl2YPps5UDVtUTAXlkdIKOKjFhH0yEhsIHhqiiDwI38F354c+mLiRh775UBbG4wC 6Dyg== X-Gm-Message-State: AOAM533zt3eoFEbzjkRB4Tn2XOxNA56ImFk5bcxlSKoS0bMXJDo1IpBg DxHmKdsS2berrShpqpuYSNoI87/nJPKTaA== X-Received: by 2002:a17:90b:1091:: with SMTP id gj17mr6452262pjb.129.1622072848675; Wed, 26 May 2021 16:47:28 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 20/31] cpu: Move AVR target vmsd field from CPUClass to DeviceClass Date: Wed, 26 May 2021 16:46:59 -0700 Message-Id: <20210526234710.125396-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé See rationale in previous commit. Targets should use the vmsd field of DeviceClass, not CPUClass. As migration is not important on the AVR target, break the migration compatibility and set the DeviceClass vmsd field. To feel safer, increment the vmstate version. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210517105140.1062037-14-f4bug@amsat.org> Signed-off-by: Richard Henderson --- target/avr/cpu.c | 2 +- target/avr/machine.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/target/avr/cpu.c b/target/avr/cpu.c index 37a8ebcc86..3353bcb9fc 100644 --- a/target/avr/cpu.c +++ b/target/avr/cpu.c @@ -213,7 +213,7 @@ static void avr_cpu_class_init(ObjectClass *oc, void *data) cc->set_pc = avr_cpu_set_pc; cc->memory_rw_debug = avr_cpu_memory_rw_debug; cc->get_phys_page_debug = avr_cpu_get_phys_page_debug; - cc->legacy_vmsd = &vms_avr_cpu; + dc->vmsd = &vms_avr_cpu; cc->disas_set_info = avr_cpu_disas_set_info; cc->gdb_read_register = avr_cpu_gdb_read_register; cc->gdb_write_register = avr_cpu_gdb_write_register; diff --git a/target/avr/machine.c b/target/avr/machine.c index de264f57c3..16f7a3e031 100644 --- a/target/avr/machine.c +++ b/target/avr/machine.c @@ -98,8 +98,8 @@ static const VMStateInfo vms_eind = { const VMStateDescription vms_avr_cpu = { .name = "cpu", - .version_id = 0, - .minimum_version_id = 0, + .version_id = 1, + .minimum_version_id = 1, .fields = (VMStateField[]) { VMSTATE_UINT32(env.pc_w, AVRCPU), VMSTATE_UINT32(env.sp, AVRCPU), From patchwork Wed May 26 23:47:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448811 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp29364jac; Wed, 26 May 2021 17:20:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWFWBg77+o4pmpp/9FapCI6nkw4iLtcJi34iU0S1A2dlNYhDgh+mugl5RkdZaNO3RHej0o X-Received: by 2002:ac8:6911:: with SMTP id e17mr741900qtr.135.1622074804450; Wed, 26 May 2021 17:20:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622074804; cv=none; d=google.com; s=arc-20160816; b=IiT04qQVQ0w9ow23MV4wSojyxzdx+RtVfkbMdCytrcQ3fGUBWzl51qY9LcZxcMWRtB e6WvokvkJHRxUCwovI1qA7endmN/HcTJtx0f185+fzXXTxEgcPRyyhZzkbTEnPhaFgTv Ysc1Ct35tLEO/3pdHYlA0lghJt0bAQSOO9R9DOQlB6llI3jKzQ3COera6NZTh8w8jLwx /Mq7i6Q1PhvIN3u9RfSUGJZH6//BhZETFpEpEXYlb09mdgoBfpJ00BnbFhy8PakzPBEI 7lXxn6tcqFEfI5jhV9ehYbIuiQvCE9JxAcOyU3Ku3peBCQqlJLa6PdsJSJCnvDbiRNzV rX5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=Zzfi92ABknfNg52jfMnZZrvowiWGHuGwWnSwt5HWe2A=; b=MxAaDlTL5rqmV+8sUH5FjtVhWdY1Gn0UYYTZyaOe4bNQH4UKQQhzIggRTU/9KWpbg3 3nTxKNEtG/fuzjBmM2y3/vIrtmu/g5hMgTZ1sI7+z9NjUrVZ+wJpHu1292wreIpPInXN eG3beMLD+WtkCjxQ8KFfwPeGA8aQfL3OA0YxbY4NmGhSIveko31sSFVeHy8v1d8zU0f9 l5MtdvNnI85DEYl7t9PsI9UZ/cNdpUfNLtxNOg5WMgEvDDNgBrslb3FGmGy1k6OZasGD 9pCZNI6D60rXrJqyO5+6N10j7TooELo5euQqHuRD/qaEsXUj8KFTUA4BSHpBuu/YMgGE s4ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NgAH5R4z; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i6si143751qkm.95.2021.05.26.17.20.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 17:20:04 -0700 (PDT) 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=NgAH5R4z; 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 Received: from localhost ([::1]:34996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3kp-0007xq-RD for patch@linaro.org; Wed, 26 May 2021 20:20:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FV-0005va-Gz for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:41 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:51740) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FK-0004Ya-Q6 for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:41 -0400 Received: by mail-pj1-x102d.google.com with SMTP id k5so1702979pjj.1 for ; Wed, 26 May 2021 16:47:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Zzfi92ABknfNg52jfMnZZrvowiWGHuGwWnSwt5HWe2A=; b=NgAH5R4zVWoG0aJJ3S3MkRAQTFCoq/s/0k0Wpz5js2XrKDXze+Wb681EC9N1RqQupT 6uRGVWPUVgEMAiS0VStQGM7/GzryOefQs9Orp7g8xSJHHbqmbKZU52/MNdjdpJu3S3Sv wMt0HZNi5P3dYmyYkgE+VqmONUS9Z/RpFmbzvsAGji0X0wmSTpAmsTeB7id0I6vjBh4d jUUXn5+i2AJVQ2143TY2xgdzYWX9Th9JkD57WPKZNEvAb7qaIIIKUHKLTIqB+FUAx6us qxOj7yAUMUEsD7qhtJPRWzyYN6vfw364KdrnrP3S2Oq5bEWL2/y+ZBb8lOmSDezj0DCY U4Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Zzfi92ABknfNg52jfMnZZrvowiWGHuGwWnSwt5HWe2A=; b=s6u6isiIXEBLuUBFiFhQADsjy0IABhWYf/svkfFy271aRMQalN/5ErYeKiwotcB8qK Bd+kl9RBZXvY7SedMxXuPXyrIPD5DoRsTkCDYpawnyXt0MPUK3HTSaWxKPJ4Veu22LHX hAwq/JzgTS4CfGaMSy2QPLaxznw3K0IUTVO0Ca2+pSrE3NR5PeLyNLIFR/wQ8GDU9gPc 3SzrfZwIlpAHniygY3NdOMy4gz+PM0ctsJa3RSbT5tlzWn6lCk/XKC0rqU15tMw0szm7 +G9qucTJO+4TVtN0MadCVQjx8QnkjzFzRG8IlM+9yxILzEba0JkOzjP57rGNophFrU6Q J1bw== X-Gm-Message-State: AOAM531mmcF9r8zRqf4+/mRB5W5ce6jkSlcjv6wo6XkaMTSxkEuVm0be xli+o1d9KaTmi9kipmlBgfxox36p43VMNA== X-Received: by 2002:a17:902:d717:b029:fe:c349:1453 with SMTP id w23-20020a170902d717b02900fec3491453mr96271ply.21.1622072849500; Wed, 26 May 2021 16:47:29 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 21/31] cpu: Introduce SysemuCPUOps structure Date: Wed, 26 May 2021 16:47:00 -0700 Message-Id: <20210526234710.125396-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Introduce a structure to hold handler specific to sysemu. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-15-f4bug@amsat.org> [rth: Squash "restrict hw/core/sysemu-cpu-ops.h" patch] Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 6 ++++++ include/hw/core/sysemu-cpu-ops.h | 21 +++++++++++++++++++++ cpu.c | 1 + target/alpha/cpu.c | 8 ++++++++ target/arm/cpu.c | 8 ++++++++ target/avr/cpu.c | 6 ++++++ target/cris/cpu.c | 8 ++++++++ target/hppa/cpu.c | 8 ++++++++ target/i386/cpu.c | 8 ++++++++ target/m68k/cpu.c | 8 ++++++++ target/microblaze/cpu.c | 8 ++++++++ target/mips/cpu.c | 8 ++++++++ target/nios2/cpu.c | 8 ++++++++ target/openrisc/cpu.c | 8 ++++++++ target/ppc/cpu_init.c | 8 ++++++++ target/riscv/cpu.c | 8 ++++++++ target/rx/cpu.c | 10 ++++++++++ target/s390x/cpu.c | 8 ++++++++ target/sh4/cpu.c | 6 ++++++ target/sparc/cpu.c | 8 ++++++++ target/tricore/cpu.c | 6 ++++++ target/xtensa/cpu.c | 6 ++++++ 22 files changed, 174 insertions(+) create mode 100644 include/hw/core/sysemu-cpu-ops.h -- 2.25.1 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 1dfb788415..cd3fb70cb5 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -80,6 +80,9 @@ struct TCGCPUOps; /* see accel-cpu.h */ struct AccelCPUClass; +/* see sysemu-cpu-ops.h */ +struct SysemuCPUOps; + /** * CPUClass: * @class_by_name: Callback to map -cpu command line model name to an @@ -191,6 +194,9 @@ struct CPUClass { bool gdb_stop_before_watchpoint; struct AccelCPUClass *accel_cpu; + /* when system emulation is not available, this pointer is NULL */ + const struct SysemuCPUOps *sysemu_ops; + /* when TCG is not available, this pointer is NULL */ struct TCGCPUOps *tcg_ops; diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h new file mode 100644 index 0000000000..e54a08ea25 --- /dev/null +++ b/include/hw/core/sysemu-cpu-ops.h @@ -0,0 +1,21 @@ +/* + * CPU operations specific to system emulation + * + * Copyright (c) 2012 SUSE LINUX Products GmbH + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#ifndef SYSEMU_CPU_OPS_H +#define SYSEMU_CPU_OPS_H + +#include "hw/core/cpu.h" + +/* + * struct SysemuCPUOps: System operations specific to a CPU class + */ +typedef struct SysemuCPUOps { +} SysemuCPUOps; + +#endif /* SYSEMU_CPU_OPS_H */ diff --git a/cpu.c b/cpu.c index c57f4c302b..e3f9804f13 100644 --- a/cpu.c +++ b/cpu.c @@ -29,6 +29,7 @@ #ifdef CONFIG_USER_ONLY #include "qemu.h" #else +#include "hw/core/sysemu-cpu-ops.h" #include "exec/address-spaces.h" #endif #include "sysemu/tcg.h" diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index 27192b62e2..0b12b2be81 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -206,6 +206,13 @@ static void alpha_cpu_initfn(Object *obj) #endif } +#ifndef CONFIG_USER_ONLY +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps alpha_sysemu_ops = { +}; +#endif + #include "hw/core/tcg-cpu-ops.h" static struct TCGCPUOps alpha_tcg_ops = { @@ -238,6 +245,7 @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data) #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = alpha_cpu_get_phys_page_debug; dc->vmsd = &vmstate_alpha_cpu; + cc->sysemu_ops = &alpha_sysemu_ops; #endif cc->disas_set_info = alpha_cpu_disas_set_info; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index bf82276611..0116e9d8e8 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1944,6 +1944,13 @@ static gchar *arm_gdb_arch_name(CPUState *cs) return g_strdup("arm"); } +#ifndef CONFIG_USER_ONLY +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps arm_sysemu_ops = { +}; +#endif + #ifdef CONFIG_TCG static struct TCGCPUOps arm_tcg_ops = { .initialize = arm_translate_init, @@ -1987,6 +1994,7 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) cc->virtio_is_big_endian = arm_cpu_virtio_is_big_endian; cc->write_elf64_note = arm_cpu_write_elf64_note; cc->write_elf32_note = arm_cpu_write_elf32_note; + cc->sysemu_ops = &arm_sysemu_ops; #endif cc->gdb_num_core_regs = 26; cc->gdb_core_xml_file = "arm-core.xml"; diff --git a/target/avr/cpu.c b/target/avr/cpu.c index 3353bcb9fc..b95caf8c0f 100644 --- a/target/avr/cpu.c +++ b/target/avr/cpu.c @@ -184,6 +184,11 @@ static void avr_cpu_dump_state(CPUState *cs, FILE *f, int flags) qemu_fprintf(f, "\n"); } +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps avr_sysemu_ops = { +}; + #include "hw/core/tcg-cpu-ops.h" static struct TCGCPUOps avr_tcg_ops = { @@ -214,6 +219,7 @@ static void avr_cpu_class_init(ObjectClass *oc, void *data) cc->memory_rw_debug = avr_cpu_memory_rw_debug; cc->get_phys_page_debug = avr_cpu_get_phys_page_debug; dc->vmsd = &vms_avr_cpu; + cc->sysemu_ops = &avr_sysemu_ops; cc->disas_set_info = avr_cpu_disas_set_info; cc->gdb_read_register = avr_cpu_gdb_read_register; cc->gdb_write_register = avr_cpu_gdb_write_register; diff --git a/target/cris/cpu.c b/target/cris/cpu.c index ed983380fc..f1095fcf5c 100644 --- a/target/cris/cpu.c +++ b/target/cris/cpu.c @@ -193,6 +193,13 @@ static void cris_cpu_initfn(Object *obj) #endif } +#ifndef CONFIG_USER_ONLY +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps cris_sysemu_ops = { +}; +#endif + #include "hw/core/tcg-cpu-ops.h" static struct TCGCPUOps crisv10_tcg_ops = { @@ -294,6 +301,7 @@ static void cris_cpu_class_init(ObjectClass *oc, void *data) #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = cris_cpu_get_phys_page_debug; dc->vmsd = &vmstate_cris_cpu; + cc->sysemu_ops = &cris_sysemu_ops; #endif cc->gdb_num_core_regs = 49; diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index d8fad52d1f..870130b159 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -131,6 +131,13 @@ static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model) return object_class_by_name(TYPE_HPPA_CPU); } +#ifndef CONFIG_USER_ONLY +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps hppa_sysemu_ops = { +}; +#endif + #include "hw/core/tcg-cpu-ops.h" static struct TCGCPUOps hppa_tcg_ops = { @@ -163,6 +170,7 @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data) #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = hppa_cpu_get_phys_page_debug; dc->vmsd = &vmstate_hppa_cpu; + cc->sysemu_ops = &hppa_sysemu_ops; #endif cc->disas_set_info = hppa_cpu_disas_set_info; cc->gdb_num_core_regs = 128; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 5a1c8ead8e..e422fab49a 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6714,6 +6714,13 @@ static Property x86_cpu_properties[] = { DEFINE_PROP_END_OF_LIST() }; +#ifndef CONFIG_USER_ONLY +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps i386_sysemu_ops = { +}; +#endif + static void x86_cpu_common_class_init(ObjectClass *oc, void *data) { X86CPUClass *xcc = X86_CPU_CLASS(oc); @@ -6750,6 +6757,7 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->write_elf32_note = x86_cpu_write_elf32_note; cc->write_elf32_qemunote = x86_cpu_write_elf32_qemunote; cc->legacy_vmsd = &vmstate_x86_cpu; + cc->sysemu_ops = &i386_sysemu_ops; #endif /* !CONFIG_USER_ONLY */ cc->gdb_arch_name = x86_gdb_arch_name; diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index a14874b4da..97ef3ae31c 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -503,6 +503,13 @@ static const VMStateDescription vmstate_m68k_cpu = { }; #endif +#ifndef CONFIG_USER_ONLY +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps m68k_sysemu_ops = { +}; +#endif + #include "hw/core/tcg-cpu-ops.h" static struct TCGCPUOps m68k_tcg_ops = { @@ -535,6 +542,7 @@ static void m68k_cpu_class_init(ObjectClass *c, void *data) #if defined(CONFIG_SOFTMMU) cc->get_phys_page_debug = m68k_cpu_get_phys_page_debug; dc->vmsd = &vmstate_m68k_cpu; + cc->sysemu_ops = &m68k_sysemu_ops; #endif cc->disas_set_info = m68k_cpu_disas_set_info; diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 433ba20203..96f221ff71 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -352,6 +352,13 @@ static ObjectClass *mb_cpu_class_by_name(const char *cpu_model) return object_class_by_name(TYPE_MICROBLAZE_CPU); } +#ifndef CONFIG_USER_ONLY +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps mb_sysemu_ops = { +}; +#endif + #include "hw/core/tcg-cpu-ops.h" static struct TCGCPUOps mb_tcg_ops = { @@ -388,6 +395,7 @@ static void mb_cpu_class_init(ObjectClass *oc, void *data) #ifndef CONFIG_USER_ONLY cc->get_phys_page_attrs_debug = mb_cpu_get_phys_page_attrs_debug; dc->vmsd = &vmstate_mb_cpu; + cc->sysemu_ops = &mb_sysemu_ops; #endif device_class_set_props(dc, mb_properties); cc->gdb_num_core_regs = 32 + 27; diff --git a/target/mips/cpu.c b/target/mips/cpu.c index eba56ac899..9a8c484cb4 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -521,6 +521,13 @@ static Property mips_cpu_properties[] = { DEFINE_PROP_END_OF_LIST() }; +#ifndef CONFIG_USER_ONLY +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps mips_sysemu_ops = { +}; +#endif + #ifdef CONFIG_TCG #include "hw/core/tcg-cpu-ops.h" /* @@ -562,6 +569,7 @@ static void mips_cpu_class_init(ObjectClass *c, void *data) #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = mips_cpu_get_phys_page_debug; cc->legacy_vmsd = &vmstate_mips_cpu; + cc->sysemu_ops = &mips_sysemu_ops; #endif cc->disas_set_info = mips_cpu_disas_set_info; cc->gdb_num_core_regs = 73; diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c index e9c9fc3a38..cb04b04d24 100644 --- a/target/nios2/cpu.c +++ b/target/nios2/cpu.c @@ -207,6 +207,13 @@ static Property nios2_properties[] = { DEFINE_PROP_END_OF_LIST(), }; +#ifndef CONFIG_USER_ONLY +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps nios2_sysemu_ops = { +}; +#endif + #include "hw/core/tcg-cpu-ops.h" static struct TCGCPUOps nios2_tcg_ops = { @@ -238,6 +245,7 @@ static void nios2_cpu_class_init(ObjectClass *oc, void *data) cc->disas_set_info = nios2_cpu_disas_set_info; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = nios2_cpu_get_phys_page_debug; + cc->sysemu_ops = &nios2_sysemu_ops; #endif cc->gdb_read_register = nios2_cpu_gdb_read_register; cc->gdb_write_register = nios2_cpu_gdb_write_register; diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index 2c64842f46..12d9173043 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -174,6 +174,13 @@ static void openrisc_any_initfn(Object *obj) | (IMMUCFGR_NTS & (ctz32(TLB_SIZE) << 2)); } +#ifndef CONFIG_USER_ONLY +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps openrisc_sysemu_ops = { +}; +#endif + #include "hw/core/tcg-cpu-ops.h" static struct TCGCPUOps openrisc_tcg_ops = { @@ -205,6 +212,7 @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data) #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = openrisc_cpu_get_phys_page_debug; dc->vmsd = &vmstate_openrisc_cpu; + cc->sysemu_ops = &openrisc_sysemu_ops; #endif cc->gdb_num_core_regs = 32 + 3; cc->disas_set_info = openrisc_disas_set_info; diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 668fd141db..302b9b92a5 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -9263,6 +9263,13 @@ static Property ppc_cpu_properties[] = { DEFINE_PROP_END_OF_LIST(), }; +#ifndef CONFIG_USER_ONLY +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps ppc_sysemu_ops = { +}; +#endif + #ifdef CONFIG_TCG #include "hw/core/tcg-cpu-ops.h" @@ -9306,6 +9313,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug; cc->legacy_vmsd = &vmstate_ppc_cpu; + cc->sysemu_ops = &ppc_sysemu_ops; #endif #if defined(CONFIG_SOFTMMU) cc->write_elf64_note = ppc64_cpu_write_elf64_note; diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 16510da259..b2b4a0baf4 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -596,6 +596,13 @@ static const char *riscv_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname) return NULL; } +#ifndef CONFIG_USER_ONLY +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps riscv_sysemu_ops = { +}; +#endif + #include "hw/core/tcg-cpu-ops.h" static struct TCGCPUOps riscv_tcg_ops = { @@ -639,6 +646,7 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data) #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = riscv_cpu_get_phys_page_debug; cc->legacy_vmsd = &vmstate_riscv_cpu; + cc->sysemu_ops = &riscv_sysemu_ops; cc->write_elf64_note = riscv_cpu_write_elf64_note; cc->write_elf32_note = riscv_cpu_write_elf32_note; #endif diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 7ac6618b26..98e6596158 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -173,6 +173,13 @@ static void rx_cpu_init(Object *obj) qdev_init_gpio_in(DEVICE(cpu), rx_cpu_set_irq, 2); } +#ifndef CONFIG_USER_ONLY +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps rx_sysemu_ops = { +}; +#endif + #include "hw/core/tcg-cpu-ops.h" static struct TCGCPUOps rx_tcg_ops = { @@ -202,6 +209,9 @@ static void rx_cpu_class_init(ObjectClass *klass, void *data) cc->dump_state = rx_cpu_dump_state; cc->set_pc = rx_cpu_set_pc; +#ifndef CONFIG_USER_ONLY + cc->sysemu_ops = &rx_sysemu_ops; +#endif cc->gdb_read_register = rx_cpu_gdb_read_register; cc->gdb_write_register = rx_cpu_gdb_write_register; cc->get_phys_page_debug = rx_cpu_get_phys_page_debug; diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 7ce425f611..77800e99b9 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -476,6 +476,13 @@ static void s390_cpu_reset_full(DeviceState *dev) return s390_cpu_reset(s, S390_CPU_RESET_CLEAR); } +#ifndef CONFIG_USER_ONLY +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps s390_sysemu_ops = { +}; +#endif + #ifdef CONFIG_TCG #include "hw/core/tcg-cpu-ops.h" @@ -519,6 +526,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) cc->legacy_vmsd = &vmstate_s390_cpu; cc->get_crash_info = s390_cpu_get_crash_info; cc->write_elf64_note = s390_cpu_write_elf64_note; + cc->sysemu_ops = &s390_sysemu_ops; #endif cc->disas_set_info = s390_cpu_disas_set_info; cc->gdb_num_core_regs = S390_NUM_CORE_REGS; diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 35d4251aaf..79aec898fa 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -223,6 +223,11 @@ static const VMStateDescription vmstate_sh_cpu = { .name = "cpu", .unmigratable = 1, }; + +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps sh4_sysemu_ops = { +}; #endif #include "hw/core/tcg-cpu-ops.h" @@ -259,6 +264,7 @@ static void superh_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_write_register = superh_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = superh_cpu_get_phys_page_debug; + cc->sysemu_ops = &sh4_sysemu_ops; dc->vmsd = &vmstate_sh_cpu; #endif cc->disas_set_info = superh_cpu_disas_set_info; diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index ba497561bf..70be0ecf5e 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -848,6 +848,13 @@ static Property sparc_cpu_properties[] = { DEFINE_PROP_END_OF_LIST() }; +#ifndef CONFIG_USER_ONLY +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps sparc_sysemu_ops = { +}; +#endif + #ifdef CONFIG_TCG #include "hw/core/tcg-cpu-ops.h" @@ -890,6 +897,7 @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data) #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = sparc_cpu_get_phys_page_debug; cc->legacy_vmsd = &vmstate_sparc_cpu; + cc->sysemu_ops = &sparc_sysemu_ops; #endif cc->disas_set_info = cpu_sparc_disas_set_info; diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index 0b1e139bcb..7dc6aab66c 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -142,6 +142,11 @@ static void tc27x_initfn(Object *obj) set_feature(&cpu->env, TRICORE_FEATURE_161); } +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps tricore_sysemu_ops = { +}; + #include "hw/core/tcg-cpu-ops.h" static struct TCGCPUOps tricore_tcg_ops = { @@ -171,6 +176,7 @@ static void tricore_cpu_class_init(ObjectClass *c, void *data) cc->dump_state = tricore_cpu_dump_state; cc->set_pc = tricore_cpu_set_pc; cc->get_phys_page_debug = tricore_cpu_get_phys_page_debug; + cc->sysemu_ops = &tricore_sysemu_ops; cc->tcg_ops = &tricore_tcg_ops; } diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index 0267571fbd..a196530451 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -180,6 +180,11 @@ static const VMStateDescription vmstate_xtensa_cpu = { .name = "cpu", .unmigratable = 1, }; + +#include "hw/core/sysemu-cpu-ops.h" + +static const struct SysemuCPUOps xtensa_sysemu_ops = { +}; #endif #include "hw/core/tcg-cpu-ops.h" @@ -216,6 +221,7 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_write_register = xtensa_cpu_gdb_write_register; cc->gdb_stop_before_watchpoint = true; #ifndef CONFIG_USER_ONLY + cc->sysemu_ops = &xtensa_sysemu_ops; cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug; dc->vmsd = &vmstate_xtensa_cpu; #endif From patchwork Wed May 26 23:47:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448325 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2b0d:0:0:0:0 with SMTP id gc13csp6045761ejc; Wed, 26 May 2021 16:52:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyovR/eP3K7/vNiOMNmR+d2A1z8lmoWqtVp4ov4oxKU+009b7fIzzj2EeCCuzPcETqmhez0 X-Received: by 2002:a5e:8305:: with SMTP id x5mr624071iom.112.1622073152883; Wed, 26 May 2021 16:52:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073152; cv=none; d=google.com; s=arc-20160816; b=xCu9eeRFuwYXb8vpXV7ZW1qVg//OWd3X/FRHnrftws1iK3hGMUldgvn4+BbFTpL+dZ NmT7OFTw0p/GMUzuFiTrkb5cUIqPl2PABbPXD9/bV0lY3Wmz/LJ/TfKIwixuZoXocVjC 92Id+SlzqVpMYppmx8REUiEaYp2lG9oOsDeZnByqL6g7WLPqik8xNqTjlaas3OTkZix4 AqbYSOqKRfN5y5x0vXzEzhocAP00mZgPXMqb+U7Lh2/CBImv/k3SkTzmWk2l73SBouqB 8Z1liJw72zUpcku0MKcaHuP2Z6BlX8PtpZpNQEKa6d3D+TRk4YOyB0guSVKKRF2JtKMX 4uhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=Kb2aLPKfx0CQ9Hf4+41N7G1NBfcWaM1Shon1mRJKU2U=; b=Nb43WX6oAGrPlyedfN2xabvgSp4/vrMBuN9QoDSD+IFnzHt/tPA9s9R8A7H9uZPTv4 lQz1mYgVKKGSlCGGV9EXEZqkXV7GPtdf2aI5d4v0+bfS5iKPLqixnoWelP3bQFlUj0Da T681zoU/9n58jCSRkbSBwiZfvfSVBbSCT+9/4VADiCSpbBJXBmu5rmIyi/UBZ84AxqO+ daQDnKjo8Yhe7LMBxptSzLLhRuvRjNJz2n3mr3MvqLlfJWVi+/1teBfwnLwGdrx1W7fr LSsL7/0t5bJl0tt+LZeMFMMeVAcfvennxIVk4+hvhdjBXddS9SWLh09N7U1M2rlIyIc6 iIQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SdRctEsY; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y196si650533iof.24.2021.05.26.16.52.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 16:52:32 -0700 (PDT) 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=SdRctEsY; 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 Received: from localhost ([::1]:36296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3KC-0003h5-5s for patch@linaro.org; Wed, 26 May 2021 19:52:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FQ-0005rT-O1 for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:36 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:55051) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FL-0004Yl-Gi for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:36 -0400 Received: by mail-pj1-x102b.google.com with SMTP id g24so1691531pji.4 for ; Wed, 26 May 2021 16:47:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Kb2aLPKfx0CQ9Hf4+41N7G1NBfcWaM1Shon1mRJKU2U=; b=SdRctEsY442kh93J6uIWb4BDbawR+qEK33hizaSsigfGGC0HNcSIKZkp+22O8QS0Ev incP7w7AP/xn2LB/RZJngKtcbYI/sDwTQTbqGsdFf7t9VRK9sfr164x+AimPuJ1YtNuw Us5ziMz1qEsQDZU0L8PkEFn7GcBpcHzGLT1TBpyG3xpJkJHZ6IRjru4FIg6coOXPdzYM WLin19MBMO6d2G9h0Yj9BNVF7RpzI759bMTo/056Hlf1BVeIhPbel6yHpsiUsCXhdFJT mf6o1ZtP84lFBhA8CB72TLs9Rtd2FX4UBDcjYjRxBOxdX2th2Hl6BsMr0oUpHLNipjtx UYRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Kb2aLPKfx0CQ9Hf4+41N7G1NBfcWaM1Shon1mRJKU2U=; b=tyxvveJn1a8X4pZK9ZBQeryFOv9J2TB6BJsVtcGgxykvUV9c9JqAgQRtfRHzIOdMje gX7gLYWx3c/ITsH8UfY5U3XO7Mdza9FQGI6zDUvuR5eiQQo2GDQeiP8bsV4lqSgUj66i 4po1RqzxKrOh/BDcHAEO8sOU+ym9UOtd9YnGC2EWB6hcPOGOH+2ZHAB3hVTT9NYSxELi I+Ty+HSyLyx4eok3KjRPBsc+nvYcVj+Y/+yF7VcWOQxoqLvwsC5t2q1JFMU8j5MJHLe8 g+H4MLSh9+RCVRknHUo1xkopbcgo6lyxkke3NUjfB6paOBP3lfdCJSr0sVpPNyuSxaI3 +DIA== X-Gm-Message-State: AOAM5331evcmcJs6dg5YIdJH7qAUONMwnL678nml+32jZMwhpMTOFs2p BuExIB98newPRk57llcVqgjszzbNG4KU2A== X-Received: by 2002:a17:902:d64e:b029:ef:8b85:d299 with SMTP id y14-20020a170902d64eb02900ef8b85d299mr520514plh.27.1622072850158; Wed, 26 May 2021 16:47:30 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 22/31] cpu: Move CPUClass::vmsd to SysemuCPUOps Date: Wed, 26 May 2021 16:47:01 -0700 Message-Id: <20210526234710.125396-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Migration is specific to system emulation. - Move the CPUClass::vmsd field to SysemuCPUOps, - restrict VMSTATE_CPU() macro to sysemu, - vmstate_dummy is now unused, remove it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-16-f4bug@amsat.org> Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 8 ++------ include/hw/core/sysemu-cpu-ops.h | 6 ++++++ include/migration/vmstate.h | 2 -- cpu.c | 15 +++++++-------- stubs/vmstate.c | 2 -- target/arm/cpu.c | 2 +- target/i386/cpu.c | 2 +- target/mips/cpu.c | 2 +- target/ppc/cpu_init.c | 2 +- target/riscv/cpu.c | 2 +- target/s390x/cpu.c | 2 +- target/sparc/cpu.c | 2 +- 12 files changed, 22 insertions(+), 25 deletions(-) -- 2.25.1 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index cd3fb70cb5..c8d4a8a642 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -125,8 +125,6 @@ struct SysemuCPUOps; * 32-bit VM coredump. * @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF * note to a 32-bit VM coredump. - * @legacy_vmsd: Legacy state description for migration. - * Do not use in new targets, use #DeviceClass::vmsd instead. * @gdb_num_core_regs: Number of core registers accessible to GDB. * @gdb_core_xml_file: File name for core registers GDB XML description. * @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to stop @@ -181,7 +179,6 @@ struct CPUClass { int (*write_elf32_qemunote)(WriteCoreDumpFunction f, CPUState *cpu, void *opaque); - const VMStateDescription *legacy_vmsd; const char *gdb_core_xml_file; gchar * (*gdb_arch_name)(CPUState *cpu); const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname); @@ -1065,10 +1062,8 @@ bool target_words_bigendian(void); #ifdef NEED_CPU_H #ifdef CONFIG_SOFTMMU + extern const VMStateDescription vmstate_cpu_common; -#else -#define vmstate_cpu_common vmstate_dummy -#endif #define VMSTATE_CPU() { \ .name = "parent_obj", \ @@ -1077,6 +1072,7 @@ extern const VMStateDescription vmstate_cpu_common; .flags = VMS_STRUCT, \ .offset = 0, \ } +#endif /* CONFIG_SOFTMMU */ #endif /* NEED_CPU_H */ diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h index e54a08ea25..0370ac1519 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -16,6 +16,12 @@ * struct SysemuCPUOps: System operations specific to a CPU class */ typedef struct SysemuCPUOps { + /** + * @legacy_vmsd: Legacy state for migration. + * Do not use in new targets, use #DeviceClass::vmsd instead. + */ + const VMStateDescription *legacy_vmsd; + } SysemuCPUOps; #endif /* SYSEMU_CPU_OPS_H */ diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 075ee80096..8df7b69f38 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -194,8 +194,6 @@ struct VMStateDescription { const VMStateDescription **subsections; }; -extern const VMStateDescription vmstate_dummy; - extern const VMStateInfo vmstate_info_bool; extern const VMStateInfo vmstate_info_int8; diff --git a/cpu.c b/cpu.c index e3f9804f13..164fefeaa3 100644 --- a/cpu.c +++ b/cpu.c @@ -128,7 +128,9 @@ const VMStateDescription vmstate_cpu_common = { void cpu_exec_realizefn(CPUState *cpu, Error **errp) { +#ifndef CONFIG_USER_ONLY CPUClass *cc = CPU_GET_CLASS(cpu); +#endif cpu_list_add(cpu); if (!accel_cpu_realizefn(cpu, errp)) { @@ -144,26 +146,23 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp) #ifdef CONFIG_USER_ONLY assert(qdev_get_vmsd(DEVICE(cpu)) == NULL || qdev_get_vmsd(DEVICE(cpu))->unmigratable); - assert(cc->legacy_vmsd == NULL); #else if (qdev_get_vmsd(DEVICE(cpu)) == NULL) { vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, cpu); } - if (cc->legacy_vmsd != NULL) { - vmstate_register(NULL, cpu->cpu_index, cc->legacy_vmsd, cpu); + if (cc->sysemu_ops->legacy_vmsd != NULL) { + vmstate_register(NULL, cpu->cpu_index, cc->sysemu_ops->legacy_vmsd, cpu); } #endif /* CONFIG_USER_ONLY */ } void cpu_exec_unrealizefn(CPUState *cpu) { +#ifndef CONFIG_USER_ONLY CPUClass *cc = CPU_GET_CLASS(cpu); -#ifdef CONFIG_USER_ONLY - assert(cc->legacy_vmsd == NULL); -#else - if (cc->legacy_vmsd != NULL) { - vmstate_unregister(NULL, cc->legacy_vmsd, cpu); + if (cc->sysemu_ops->legacy_vmsd != NULL) { + vmstate_unregister(NULL, cc->sysemu_ops->legacy_vmsd, cpu); } if (qdev_get_vmsd(DEVICE(cpu)) == NULL) { vmstate_unregister(NULL, &vmstate_cpu_common, cpu); diff --git a/stubs/vmstate.c b/stubs/vmstate.c index cc4fe41dfc..8513d9204e 100644 --- a/stubs/vmstate.c +++ b/stubs/vmstate.c @@ -1,8 +1,6 @@ #include "qemu/osdep.h" #include "migration/vmstate.h" -const VMStateDescription vmstate_dummy = {}; - int vmstate_register_with_alias_id(VMStateIf *obj, uint32_t instance_id, const VMStateDescription *vmsd, diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 0116e9d8e8..bd623a4961 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1948,6 +1948,7 @@ static gchar *arm_gdb_arch_name(CPUState *cs) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps arm_sysemu_ops = { + .legacy_vmsd = &vmstate_arm_cpu, }; #endif @@ -1990,7 +1991,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) #ifndef CONFIG_USER_ONLY cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug; cc->asidx_from_attrs = arm_asidx_from_attrs; - cc->legacy_vmsd = &vmstate_arm_cpu; cc->virtio_is_big_endian = arm_cpu_virtio_is_big_endian; cc->write_elf64_note = arm_cpu_write_elf64_note; cc->write_elf32_note = arm_cpu_write_elf32_note; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index e422fab49a..761fffee34 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6718,6 +6718,7 @@ static Property x86_cpu_properties[] = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps i386_sysemu_ops = { + .legacy_vmsd = &vmstate_x86_cpu, }; #endif @@ -6756,7 +6757,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->write_elf64_qemunote = x86_cpu_write_elf64_qemunote; cc->write_elf32_note = x86_cpu_write_elf32_note; cc->write_elf32_qemunote = x86_cpu_write_elf32_qemunote; - cc->legacy_vmsd = &vmstate_x86_cpu; cc->sysemu_ops = &i386_sysemu_ops; #endif /* !CONFIG_USER_ONLY */ diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 9a8c484cb4..7aa3f3ecf5 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -525,6 +525,7 @@ static Property mips_cpu_properties[] = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps mips_sysemu_ops = { + .legacy_vmsd = &vmstate_mips_cpu, }; #endif @@ -568,7 +569,6 @@ static void mips_cpu_class_init(ObjectClass *c, void *data) cc->gdb_write_register = mips_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = mips_cpu_get_phys_page_debug; - cc->legacy_vmsd = &vmstate_mips_cpu; cc->sysemu_ops = &mips_sysemu_ops; #endif cc->disas_set_info = mips_cpu_disas_set_info; diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 302b9b92a5..5121f9cfd4 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -9267,6 +9267,7 @@ static Property ppc_cpu_properties[] = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps ppc_sysemu_ops = { + .legacy_vmsd = &vmstate_ppc_cpu, }; #endif @@ -9312,7 +9313,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_write_register = ppc_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug; - cc->legacy_vmsd = &vmstate_ppc_cpu; cc->sysemu_ops = &ppc_sysemu_ops; #endif #if defined(CONFIG_SOFTMMU) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index b2b4a0baf4..44b1f70051 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -600,6 +600,7 @@ static const char *riscv_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps riscv_sysemu_ops = { + .legacy_vmsd = &vmstate_riscv_cpu, }; #endif @@ -645,7 +646,6 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data) cc->disas_set_info = riscv_cpu_disas_set_info; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = riscv_cpu_get_phys_page_debug; - cc->legacy_vmsd = &vmstate_riscv_cpu; cc->sysemu_ops = &riscv_sysemu_ops; cc->write_elf64_note = riscv_cpu_write_elf64_note; cc->write_elf32_note = riscv_cpu_write_elf32_note; diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 77800e99b9..d7ab7c95b1 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -480,6 +480,7 @@ static void s390_cpu_reset_full(DeviceState *dev) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps s390_sysemu_ops = { + .legacy_vmsd = &vmstate_s390_cpu, }; #endif @@ -523,7 +524,6 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_write_register = s390_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = s390_cpu_get_phys_page_debug; - cc->legacy_vmsd = &vmstate_s390_cpu; cc->get_crash_info = s390_cpu_get_crash_info; cc->write_elf64_note = s390_cpu_write_elf64_note; cc->sysemu_ops = &s390_sysemu_ops; diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 70be0ecf5e..ffe85a7f59 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -852,6 +852,7 @@ static Property sparc_cpu_properties[] = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps sparc_sysemu_ops = { + .legacy_vmsd = &vmstate_sparc_cpu, }; #endif @@ -896,7 +897,6 @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_write_register = sparc_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = sparc_cpu_get_phys_page_debug; - cc->legacy_vmsd = &vmstate_sparc_cpu; cc->sysemu_ops = &sparc_sysemu_ops; #endif cc->disas_set_info = cpu_sparc_disas_set_info; From patchwork Wed May 26 23:47:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448386 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp16563jac; Wed, 26 May 2021 17:00:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoP3fEJ1IKP7KZF7tylqypqiJVUg3P1LPX+KXfUiVye2Qc/i7g+4T/lSYKPkXprVI8hujV X-Received: by 2002:ac8:588e:: with SMTP id t14mr699322qta.39.1622073609786; Wed, 26 May 2021 17:00:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073609; cv=none; d=google.com; s=arc-20160816; b=AZUstaaPB7gTxGNyYaNbzqBrzI5onjCKNP0RUpIiGoHLU1/ej0r6nJUEjR7rJbdskj HoTau+4ZE3y9C/bRyFUhTGd2d8OHLcvEHMiAyhvHMdYCizYriQZqc2vu/Pfy4OMTpKEy SrWRuyfXeFuMC8YYL0aET7n+vJkMS9lwwo5ej9wh/Y7ozPj6xX0FDFf2YDuuLUJLPh+Q HIVkJMoa7btF/gjWsuPoBsbBD9nO1Ksfuf4IR4aubismgM5DSxUMFY+qdx4tQ6weR7Qt Quot5m7ypkZT99HKuzGeqYWWEo4L1hO5GSkkaQJzznT9yw5ZFQczXaCcHwINs2eTY/7G cYNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=i9sjalUJzXMjcjyM8v8NrOBCxoHFCzoZhE1tMS09ZS0=; b=jvfyGD1Mu2LkTJ6DnoRVgW5V2roqwyhhuH6v4heq3+M+3+UdyxMlYyrOWlk4e1jTOx Ts8dOsDFQKtc8RbwPPOYvg1lG7cgtYVm1CqA6JpRblC8kXTRJ4D6rUzkugrf4yItMFFY b0FEWbd3A9NlpyKaKi7ICB+BidhAUUBBtpHJlB0K0J1FSskfJ5HwUJwhswIVt9e+k8p0 F+3XIdlwineDxH4Ztv/LWmfbxnb4qWGUjTyHUAkh4hBS+20sHiu8TLjvw++t6kpMi+P1 8C9X1jOqBiEeXMGrxeWyZQqQ9B6t5PlNoGV5NeZho2JS2BjOG+jLhAIIp0mOvktA3h/K 5iFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WA4TJgVc; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z6si267516qki.136.2021.05.26.17.00.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 17:00:09 -0700 (PDT) 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=WA4TJgVc; 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 Received: from localhost ([::1]:36184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3RZ-0005qm-3l for patch@linaro.org; Wed, 26 May 2021 20:00:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FV-0005w8-Mq for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:41 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:33465) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FM-0004ZW-7u for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:41 -0400 Received: by mail-pl1-x635.google.com with SMTP id b7so1442531plg.0 for ; Wed, 26 May 2021 16:47:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=i9sjalUJzXMjcjyM8v8NrOBCxoHFCzoZhE1tMS09ZS0=; b=WA4TJgVcUZnGKzQpqnyNs8o55zSoz4EoSFJwsDFyc+9M7G+G7U7Pol9zOwCPI0Qcll 7VW5DTCtdTUwADJVf4L0OgdQE20HDeAAEFeHNU6RZjcJGU7VvtdqZbsKkLIzAyIzSCU+ i2jVEydHwyv2oOdjlbDOPj0g7OJBFvHfnpCFe38YW8WsGnAzY4ZhiTzvHnJO3Bnk3gqR LhhHEZOGUIIbovfKg4bEL6r/JoPLjqBmE5PqncFrZuBesykzRzmJc5YMEDTf/Q4Bxkp7 6O1C/0WkWNEt/KkyW4keL2DEzyY8pRZmBwUDEhJUds39Ik8VSZfrflw6BexlAEzlw/Tq tbCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i9sjalUJzXMjcjyM8v8NrOBCxoHFCzoZhE1tMS09ZS0=; b=bu9krZ0r9WNvUzcc9bJzzFnsbZpZtawwRrHsnEFQRkb24odKao9UohUZSeVFWdmckT eHVO9s3RZvQFpik3L3MDTgYzjucJabIkcUdfn0rSQW6lAdV9Z1cyjmByB/HDmR6pZ9HR d0KX1n7K7J8wLyqMB+CO9h1PFCZAO0YKSLbyszjtVe+rRrvAncF4ip8rwjh76TPP2Bjn Mushe5+Cy9bKw3MIR6ROCjPW72bVoEwsi1gNj/f3Qo1g6lh6kWQkYZXAIcBYP2Vb6ETp CudO6oRFiKygZ8s8SSpNlzMq7vRIWhV/6mNWcCYoMX8s7rpwgABtdNnbIAUFH4SMqV6v ZyKA== X-Gm-Message-State: AOAM532cM3tFJv2xX/HjzyuHkefC7VZJmNqMJgWUuq5ZS4C+cG+H+Q1v i0XukHO5ATaRnXMwAagZmBVi1KxctIQPjQ== X-Received: by 2002:a17:90a:1fc1:: with SMTP id z1mr6448560pjz.183.1622072850773; Wed, 26 May 2021 16:47:30 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 23/31] cpu: Move CPUClass::virtio_is_big_endian to SysemuCPUOps Date: Wed, 26 May 2021 16:47:02 -0700 Message-Id: <20210526234710.125396-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé VirtIO devices are only meaningful with system emulation. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-17-f4bug@amsat.org> Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 5 ----- include/hw/core/sysemu-cpu-ops.h | 9 +++++++++ hw/core/cpu-sysemu.c | 5 +++-- target/arm/cpu.c | 2 +- target/ppc/cpu_init.c | 4 +--- 5 files changed, 14 insertions(+), 11 deletions(-) -- 2.25.1 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index c8d4a8a642..dd3f5f996e 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -90,10 +90,6 @@ struct SysemuCPUOps; * @parse_features: Callback to parse command line arguments. * @reset_dump_flags: #CPUDumpFlags to use for reset logging. * @has_work: Callback for checking if there is work to do. - * @virtio_is_big_endian: Callback to return %true if a CPU which supports - * runtime configurable endianness is currently big-endian. Non-configurable - * CPUs can use the default implementation of this method. This method should - * not be used by any callers other than the pre-1.0 virtio devices. * @memory_rw_debug: Callback for GDB memory access. * @dump_state: Callback for dumping state. * @dump_statistics: Callback for dumping statistics. @@ -152,7 +148,6 @@ struct CPUClass { int reset_dump_flags; bool (*has_work)(CPUState *cpu); - bool (*virtio_is_big_endian)(CPUState *cpu); int (*memory_rw_debug)(CPUState *cpu, vaddr addr, uint8_t *buf, int len, bool is_write); void (*dump_state)(CPUState *cpu, FILE *, int flags); diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h index 0370ac1519..8fa98bf2a7 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -16,6 +16,15 @@ * struct SysemuCPUOps: System operations specific to a CPU class */ typedef struct SysemuCPUOps { + /** + * @virtio_is_big_endian: Callback to return %true if a CPU which supports + * runtime configurable endianness is currently big-endian. + * Non-configurable CPUs can use the default implementation of this method. + * This method should not be used by any callers other than the pre-1.0 + * virtio devices. + */ + bool (*virtio_is_big_endian)(CPUState *cpu); + /** * @legacy_vmsd: Legacy state for migration. * Do not use in new targets, use #DeviceClass::vmsd instead. diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c index aa68ca281e..bad7d2cb01 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "hw/core/cpu.h" +#include "hw/core/sysemu-cpu-ops.h" bool cpu_paging_enabled(const CPUState *cpu) { @@ -126,8 +127,8 @@ bool cpu_virtio_is_big_endian(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); - if (cc->virtio_is_big_endian) { - return cc->virtio_is_big_endian(cpu); + if (cc->sysemu_ops->virtio_is_big_endian) { + return cc->sysemu_ops->virtio_is_big_endian(cpu); } return target_words_bigendian(); } diff --git a/target/arm/cpu.c b/target/arm/cpu.c index bd623a4961..0111201235 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1948,6 +1948,7 @@ static gchar *arm_gdb_arch_name(CPUState *cs) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps arm_sysemu_ops = { + .virtio_is_big_endian = arm_cpu_virtio_is_big_endian, .legacy_vmsd = &vmstate_arm_cpu, }; #endif @@ -1991,7 +1992,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) #ifndef CONFIG_USER_ONLY cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug; cc->asidx_from_attrs = arm_asidx_from_attrs; - cc->virtio_is_big_endian = arm_cpu_virtio_is_big_endian; cc->write_elf64_note = arm_cpu_write_elf64_note; cc->write_elf32_note = arm_cpu_write_elf32_note; cc->sysemu_ops = &arm_sysemu_ops; diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 5121f9cfd4..108e0c6580 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -9267,6 +9267,7 @@ static Property ppc_cpu_properties[] = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps ppc_sysemu_ops = { + .virtio_is_big_endian = ppc_cpu_is_big_endian, .legacy_vmsd = &vmstate_ppc_cpu, }; #endif @@ -9335,9 +9336,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_core_xml_file = "power64-core.xml"; #else cc->gdb_core_xml_file = "power-core.xml"; -#endif -#ifndef CONFIG_USER_ONLY - cc->virtio_is_big_endian = ppc_cpu_is_big_endian; #endif cc->disas_set_info = ppc_disas_set_info; From patchwork Wed May 26 23:47:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448521 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp20599jac; Wed, 26 May 2021 17:05:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9YK6Qwu+MCUXJO9nb9NPbam37rEZEv1jmvVlxybxM/XtTAD8JewqrTsV2Q3aXYF0q1kxA X-Received: by 2002:ab0:4582:: with SMTP id u2mr343724uau.78.1622073947749; Wed, 26 May 2021 17:05:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073947; cv=none; d=google.com; s=arc-20160816; b=qCXV1tde/lxwRIWyuyaaF2JyjWZI2mEc4uNzOXWZHI88kUiuXOiJMa7dW+UEzoXSP/ Ve1Ip7QZOTrNCx1BV5B9ShwnwjDl9mN9Lfho6TQ20Jh/3yQLNxnvITfCfFOuTMGUw6Ct Pgd50Nxrqefpf+eYOFqxMiu9GAQJmLCN22qdKR7uMaiGjSQ8Vd5RhMfjYtj0GAlkV3z0 6S3ufESzhofgjictNmP5T+ARRDR5H0loBW8u4dTFSTvmwA3APnfuS/y8dWsdYJhtjqfS uv+WbwbnxGfbb2jeuyHhNG6aApROYFSRQvEcRnnw+MY+2BqFJtIEYg6jVgVKSInOlUHj r3rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=PfGGDG54V+Z0/V/+AKWHcOfTeapHdTuypjBhgufuU0w=; b=Y2Y+Q5FMALPnoKehRBDBa3jvf9HEy5c6P3/wVT3E6xD60vJxfF83Pqx4GcwbvAtgCq atPm17sksFnL+K6cpzMf7Ho9f70k5JmgLxRdH6dYbgFPBv2hhtZ+6F4vbY2p15p8V4PX QVlt6C7kbXRnrgp6cwEKHCNEvR8ZsZNwo6j2OpzVp0IcUNK4q/7lSdciP4WSNOGJx4/D wwrAXFc2EnEQek0o0q3Cx3VwbYiBuahB39DIiEK8Bz5gXTXtRmjg/a+gULQ+yKfges5k dehfAsdSfG/4GAjmd2DbjIqZ+u3k/ZYF8I3QnOxJ8/5c6+8nFjsfnClPp+k1i0XuVxmh FpHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Aq2PNBYm; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p27si324363vsl.164.2021.05.26.17.05.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 17:05:47 -0700 (PDT) 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=Aq2PNBYm; 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 Received: from localhost ([::1]:44184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3X1-0002t3-0D for patch@linaro.org; Wed, 26 May 2021 20:05:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FW-0005xS-2i for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:42 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:46981) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FN-0004aP-6V for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:41 -0400 Received: by mail-pl1-x633.google.com with SMTP id d20so1407894pls.13 for ; Wed, 26 May 2021 16:47:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PfGGDG54V+Z0/V/+AKWHcOfTeapHdTuypjBhgufuU0w=; b=Aq2PNBYmBol/sPj/oIA2vpVqD1YeLNautafMJZ5wGel/QzBernrUCJ77JietGIG+tn yAZpLJImw2uy8v5b3e4G/79fKFwyhQpxZn5BZcU+9PEG39i7WxuOp2i3YCGQrChEtQg7 Zx2GjHfSAw04nL7fC7bAmi4h1Nqbm4UIO3pybludCyWVbG8YSz3XN2N+nT1uIatbVr4J xqa2ua0xr/lI111XSseHLXBt4vb95AE/LSBvOfoiEv1+7JBSd5RYE5vyo+Bg1aX7CYn2 l1Vt2zQpXUCWqQPWPV4Wrfm80N/adCNqnMbbRrLFDHBpN6tYdpwcpaHhQtxgMjEXpJ4T fMIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PfGGDG54V+Z0/V/+AKWHcOfTeapHdTuypjBhgufuU0w=; b=Uy9L1+EzUnK8AxTplbF+jsnLfD7QPfQHy8TgtPK1sBi3CoByIY0l618qQZT8VyPifZ zlf+n0jppBiC8rf7sNBAHh0Q9jYsMp2xBkd9JDOF+CH93aF4untAED1yX/St9eNzFUH5 Yipx7xepJ7gV4Kr8YdHdY139xFazPHT38iSCprEFSyVYXrpgqzD/2YudjMNCNHyd7flo SxYEx6qV799o4cxV919NA4Nv9yqNV3neKl26qaLKDxrwe0pFKU7jzz4NTXyG06lcrwW5 jEn46y0e1/IuWwGSIomOlQXOKWLeFbGcJYRxoIL99AK+6EwWQU1NNhtJTUUcMBCu0LE+ u6uQ== X-Gm-Message-State: AOAM531TP4qKrJvFZ3gAuPza7MRG70uvoPrC4CpVCakrEGM7Cy9nzIR1 KLY5lA9RhWKRlZIJrVQdT6ltp5m9BxAL2A== X-Received: by 2002:a17:902:74c9:b029:fd:23e6:1bd9 with SMTP id f9-20020a17090274c9b02900fd23e61bd9mr618525plt.36.1622072851796; Wed, 26 May 2021 16:47:31 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 24/31] cpu: Move CPUClass::get_crash_info to SysemuCPUOps Date: Wed, 26 May 2021 16:47:03 -0700 Message-Id: <20210526234710.125396-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé cpu_get_crash_info() is called on GUEST_PANICKED events, which only occur in system emulation. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-18-f4bug@amsat.org> Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 1 - include/hw/core/sysemu-cpu-ops.h | 5 +++++ hw/core/cpu-sysemu.c | 4 ++-- target/i386/cpu.c | 2 +- target/s390x/cpu.c | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) -- 2.25.1 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index dd3f5f996e..bf7d11b14f 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -151,7 +151,6 @@ struct CPUClass { int (*memory_rw_debug)(CPUState *cpu, vaddr addr, uint8_t *buf, int len, bool is_write); void (*dump_state)(CPUState *cpu, FILE *, int flags); - GuestPanicInformation* (*get_crash_info)(CPUState *cpu); void (*dump_statistics)(CPUState *cpu, int flags); int64_t (*get_arch_id)(CPUState *cpu); bool (*get_paging_enabled)(const CPUState *cpu); diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h index 8fa98bf2a7..b9383101fc 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -16,6 +16,11 @@ * struct SysemuCPUOps: System operations specific to a CPU class */ typedef struct SysemuCPUOps { + /** + * @get_crash_info: Callback for reporting guest crash information in + * GUEST_PANICKED events. + */ + GuestPanicInformation* (*get_crash_info)(CPUState *cpu); /** * @virtio_is_big_endian: Callback to return %true if a CPU which supports * runtime configurable endianness is currently big-endian. diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c index bad7d2cb01..90b5ac8eb9 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -138,8 +138,8 @@ GuestPanicInformation *cpu_get_crash_info(CPUState *cpu) CPUClass *cc = CPU_GET_CLASS(cpu); GuestPanicInformation *res = NULL; - if (cc->get_crash_info) { - res = cc->get_crash_info(cpu); + if (cc->sysemu_ops->get_crash_info) { + res = cc->sysemu_ops->get_crash_info(cpu); } return res; } diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 761fffee34..7761f2fa4c 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6718,6 +6718,7 @@ static Property x86_cpu_properties[] = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps i386_sysemu_ops = { + .get_crash_info = x86_cpu_get_crash_info, .legacy_vmsd = &vmstate_x86_cpu, }; #endif @@ -6752,7 +6753,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->asidx_from_attrs = x86_asidx_from_attrs; cc->get_memory_mapping = x86_cpu_get_memory_mapping; cc->get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug; - cc->get_crash_info = x86_cpu_get_crash_info; cc->write_elf64_note = x86_cpu_write_elf64_note; cc->write_elf64_qemunote = x86_cpu_write_elf64_qemunote; cc->write_elf32_note = x86_cpu_write_elf32_note; diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index d7ab7c95b1..d2175a87f5 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -480,6 +480,7 @@ static void s390_cpu_reset_full(DeviceState *dev) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps s390_sysemu_ops = { + .get_crash_info = s390_cpu_get_crash_info, .legacy_vmsd = &vmstate_s390_cpu, }; #endif @@ -524,7 +525,6 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_write_register = s390_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = s390_cpu_get_phys_page_debug; - cc->get_crash_info = s390_cpu_get_crash_info; cc->write_elf64_note = s390_cpu_write_elf64_note; cc->sysemu_ops = &s390_sysemu_ops; #endif From patchwork Wed May 26 23:47:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448812 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp30424jac; Wed, 26 May 2021 17:22:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUQKua9pkU2qT3m1AUknh68dc3peT4dnxS9SKeSjv43bYRN+rR+o6jaVSGb10hr+cJmXhg X-Received: by 2002:a25:4fc4:: with SMTP id d187mr902764ybb.245.1622074922546; Wed, 26 May 2021 17:22:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622074922; cv=none; d=google.com; s=arc-20160816; b=O56oQrwQIpqj0wT/dbNCtoLGiNSQXIXkTJMyKQhsAnVVdILAR5mtgaWKIUoZFOsM5J kZu2U1wSVcO69+s8FawzrB3G4tiqs5+Z74wrGXcdaQUrceBu9IBjFQP9PEKRe0ZJao5O XMug0b7t6uDubY0qy7qhpRvLP8ELnacZ5uTQ4rGlBIKXwiFdbXEkQ7pjMDSs38PzZmOJ GOLfVI2Vs249QIMDeErcOOE/1yGifzCwTWBEhvg5k9x2lsRfSFJYJw1MlDSl0lqx2igk B8kQa4OHm2culdBgSTAxX1PRfWZ/2CRvG3X/C2Px24Fcpxcnb6IyYCOAkIwv9im268o+ mMpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=pgfHDBcBGjm3dTOmqTxTp7GXgcPswruAXgL6gnPssQw=; b=X1xq+RE/Vkh8NnZLYVU0wKdBBw10cSMS/v5KsyPdGm1jaUM5td6wfvSdcVeaK1eQQE r39p9kjKbofQMI9SUuvDjy1EXUyxbDO8IW/kPgxSqWbbADYeo/BpNnIuA2Avbny7xlAZ KKphwUyEpgYnticZQuu2gw616h56TBjITWn4AAphtOkE22xBhytXAt2qoxu/3ZsqZeme DF6SBNulQrY1d9pEp4uENf8YS+EZiybJ5wFxHH4CEoaw5mjBOes4JMKpk8Uw5zNPQtaF yoUxtEhyunoZ6aEeIN8Yyf2wQRls7cHCWtcaNbrIuIr1im6qoMENw5glh67X0wG+QS1k Jczg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x3zI1jfo; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x13si789363ybj.153.2021.05.26.17.22.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 17:22:02 -0700 (PDT) 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=x3zI1jfo; 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 Received: from localhost ([::1]:37108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3mj-00017P-Ud for patch@linaro.org; Wed, 26 May 2021 20:22:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FY-00064d-1L for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:44 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:33456) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FO-0004bV-6B for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:43 -0400 Received: by mail-pl1-x62b.google.com with SMTP id b7so1442570plg.0 for ; Wed, 26 May 2021 16:47:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pgfHDBcBGjm3dTOmqTxTp7GXgcPswruAXgL6gnPssQw=; b=x3zI1jfohF2bQiefU9wXXY/rnpwJGCrJskQ5nYVY7njT6PkZdiEGCz1FmuyPtpnn7d UTczZv3EqAdKxPz0GsfrBeUh9cu8uTH2XwSNJ/7NTHKYo3KOr53tIF8NxXWCz66k7JeS FO8QA1Sh3Bh9GFOH+Mi6/gfC9Cy2KFGLd7DkFC2FWSn3YobPt4If8GKk0xPmxG53F6bC tF3sCH8h4ZramrQVYXfQVkh/Xh/cNME4wgB23CNRiyK6W0jHlkYxbfoisJJIs5oUbCfr uHzKW8Tup2q3jw9wjiH2KRDfStgut8PphckZcFNEry8pbWILgn/Cfsr5Xtx+KhJwCMa+ xseQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pgfHDBcBGjm3dTOmqTxTp7GXgcPswruAXgL6gnPssQw=; b=aZdAOBkjajNjT7WAJ9R7CpZ2jVl+R6nqpS/yxpLvsDrBcTfudtYeTKkUOPaZ7sHNUt NKfK24gQ9ISuNvBg32dlnlWkmezyXwFekmzEG9cJCa8WX1+hY4QA0/Uxoiog4wRKoAiy g3mJwbn3ZHR3/sTk2th7AFZN7pVwmNp2rswpMxm+ctp/iyz6CXKsvBpK2Sw6Nq0LNGOZ ZjNhrF4K91M1j+o3m8TdAbvzo7qhF1j9a3RziSIFrJRnAj8FTP1IxSY4IbFLC3n2ejwE KtS7s8/73P1V8/8LuhuxnQr1rG97ctEW5gncA3ZyAjDJwwlm2Ldd8CHoo9ABiUh4gW3B 4lVg== X-Gm-Message-State: AOAM5338AlkJcQhmq6bQGwnxHxjJIA5dp1gRE1/OZbR2oulixk5GXadL JAXjHAqFrer9Db4qcbCEqxtq+6zD0DWlIQ== X-Received: by 2002:a17:90a:d193:: with SMTP id fu19mr692468pjb.103.1622072852899; Wed, 26 May 2021 16:47:32 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 25/31] cpu: Move CPUClass::write_elf* to SysemuCPUOps Date: Wed, 26 May 2021 16:47:04 -0700 Message-Id: <20210526234710.125396-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé The write_elf*() handlers are used to dump vmcore images. This feature is only meaningful for system emulation. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-19-f4bug@amsat.org> Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 17 ----------------- include/hw/core/sysemu-cpu-ops.h | 24 ++++++++++++++++++++++++ hw/core/cpu-sysemu.c | 16 ++++++++-------- target/arm/cpu.c | 4 ++-- target/i386/cpu.c | 8 ++++---- target/ppc/cpu_init.c | 6 ++---- target/riscv/cpu.c | 4 ++-- target/s390x/cpu.c | 2 +- 8 files changed, 43 insertions(+), 38 deletions(-) -- 2.25.1 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index bf7d11b14f..15b16d3f6d 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -113,14 +113,6 @@ struct SysemuCPUOps; * a memory access with the specified memory transaction attributes. * @gdb_read_register: Callback for letting GDB read a register. * @gdb_write_register: Callback for letting GDB write a register. - * @write_elf64_note: Callback for writing a CPU-specific ELF note to a - * 64-bit VM coredump. - * @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF - * note to a 32-bit VM coredump. - * @write_elf32_note: Callback for writing a CPU-specific ELF note to a - * 32-bit VM coredump. - * @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF - * note to a 32-bit VM coredump. * @gdb_num_core_regs: Number of core registers accessible to GDB. * @gdb_core_xml_file: File name for core registers GDB XML description. * @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to stop @@ -164,15 +156,6 @@ struct CPUClass { int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg); int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg); - int (*write_elf64_note)(WriteCoreDumpFunction f, CPUState *cpu, - int cpuid, void *opaque); - int (*write_elf64_qemunote)(WriteCoreDumpFunction f, CPUState *cpu, - void *opaque); - int (*write_elf32_note)(WriteCoreDumpFunction f, CPUState *cpu, - int cpuid, void *opaque); - int (*write_elf32_qemunote)(WriteCoreDumpFunction f, CPUState *cpu, - void *opaque); - const char *gdb_core_xml_file; gchar * (*gdb_arch_name)(CPUState *cpu); const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname); diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h index b9383101fc..52ac0ae4e1 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -21,6 +21,30 @@ typedef struct SysemuCPUOps { * GUEST_PANICKED events. */ GuestPanicInformation* (*get_crash_info)(CPUState *cpu); + /** + * @write_elf32_note: Callback for writing a CPU-specific ELF note to a + * 32-bit VM coredump. + */ + int (*write_elf32_note)(WriteCoreDumpFunction f, CPUState *cpu, + int cpuid, void *opaque); + /** + * @write_elf64_note: Callback for writing a CPU-specific ELF note to a + * 64-bit VM coredump. + */ + int (*write_elf64_note)(WriteCoreDumpFunction f, CPUState *cpu, + int cpuid, void *opaque); + /** + * @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF + * note to a 32-bit VM coredump. + */ + int (*write_elf32_qemunote)(WriteCoreDumpFunction f, CPUState *cpu, + void *opaque); + /** + * @write_elf64_qemunote: Callback for writing a CPU- and QEMU-specific ELF + * note to a 64-bit VM coredump. + */ + int (*write_elf64_qemunote)(WriteCoreDumpFunction f, CPUState *cpu, + void *opaque); /** * @virtio_is_big_endian: Callback to return %true if a CPU which supports * runtime configurable endianness is currently big-endian. diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c index 90b5ac8eb9..d55ef8d23d 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -84,10 +84,10 @@ int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu, { CPUClass *cc = CPU_GET_CLASS(cpu); - if (!cc->write_elf32_qemunote) { + if (!cc->sysemu_ops->write_elf32_qemunote) { return 0; } - return (*cc->write_elf32_qemunote)(f, cpu, opaque); + return (*cc->sysemu_ops->write_elf32_qemunote)(f, cpu, opaque); } int cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu, @@ -95,10 +95,10 @@ int cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu, { CPUClass *cc = CPU_GET_CLASS(cpu); - if (!cc->write_elf32_note) { + if (!cc->sysemu_ops->write_elf32_note) { return -1; } - return (*cc->write_elf32_note)(f, cpu, cpuid, opaque); + return (*cc->sysemu_ops->write_elf32_note)(f, cpu, cpuid, opaque); } int cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu, @@ -106,10 +106,10 @@ int cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu, { CPUClass *cc = CPU_GET_CLASS(cpu); - if (!cc->write_elf64_qemunote) { + if (!cc->sysemu_ops->write_elf64_qemunote) { return 0; } - return (*cc->write_elf64_qemunote)(f, cpu, opaque); + return (*cc->sysemu_ops->write_elf64_qemunote)(f, cpu, opaque); } int cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu, @@ -117,10 +117,10 @@ int cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu, { CPUClass *cc = CPU_GET_CLASS(cpu); - if (!cc->write_elf64_note) { + if (!cc->sysemu_ops->write_elf64_note) { return -1; } - return (*cc->write_elf64_note)(f, cpu, cpuid, opaque); + return (*cc->sysemu_ops->write_elf64_note)(f, cpu, cpuid, opaque); } bool cpu_virtio_is_big_endian(CPUState *cpu) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 0111201235..18627cc3c6 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1948,6 +1948,8 @@ static gchar *arm_gdb_arch_name(CPUState *cs) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps arm_sysemu_ops = { + .write_elf32_note = arm_cpu_write_elf32_note, + .write_elf64_note = arm_cpu_write_elf64_note, .virtio_is_big_endian = arm_cpu_virtio_is_big_endian, .legacy_vmsd = &vmstate_arm_cpu, }; @@ -1992,8 +1994,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) #ifndef CONFIG_USER_ONLY cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug; cc->asidx_from_attrs = arm_asidx_from_attrs; - cc->write_elf64_note = arm_cpu_write_elf64_note; - cc->write_elf32_note = arm_cpu_write_elf32_note; cc->sysemu_ops = &arm_sysemu_ops; #endif cc->gdb_num_core_regs = 26; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 7761f2fa4c..2ba82921d6 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6719,6 +6719,10 @@ static Property x86_cpu_properties[] = { static const struct SysemuCPUOps i386_sysemu_ops = { .get_crash_info = x86_cpu_get_crash_info, + .write_elf32_note = x86_cpu_write_elf32_note, + .write_elf64_note = x86_cpu_write_elf64_note, + .write_elf32_qemunote = x86_cpu_write_elf32_qemunote, + .write_elf64_qemunote = x86_cpu_write_elf64_qemunote, .legacy_vmsd = &vmstate_x86_cpu, }; #endif @@ -6753,10 +6757,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->asidx_from_attrs = x86_asidx_from_attrs; cc->get_memory_mapping = x86_cpu_get_memory_mapping; cc->get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug; - cc->write_elf64_note = x86_cpu_write_elf64_note; - cc->write_elf64_qemunote = x86_cpu_write_elf64_qemunote; - cc->write_elf32_note = x86_cpu_write_elf32_note; - cc->write_elf32_qemunote = x86_cpu_write_elf32_qemunote; cc->sysemu_ops = &i386_sysemu_ops; #endif /* !CONFIG_USER_ONLY */ diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 108e0c6580..16d966696b 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -9267,6 +9267,8 @@ static Property ppc_cpu_properties[] = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps ppc_sysemu_ops = { + .write_elf32_note = ppc32_cpu_write_elf32_note, + .write_elf64_note = ppc64_cpu_write_elf64_note, .virtio_is_big_endian = ppc_cpu_is_big_endian, .legacy_vmsd = &vmstate_ppc_cpu, }; @@ -9316,10 +9318,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug; cc->sysemu_ops = &ppc_sysemu_ops; #endif -#if defined(CONFIG_SOFTMMU) - cc->write_elf64_note = ppc64_cpu_write_elf64_note; - cc->write_elf32_note = ppc32_cpu_write_elf32_note; -#endif cc->gdb_num_core_regs = 71; #ifndef CONFIG_USER_ONLY diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 44b1f70051..80cee005a3 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -600,6 +600,8 @@ static const char *riscv_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps riscv_sysemu_ops = { + .write_elf64_note = riscv_cpu_write_elf64_note, + .write_elf32_note = riscv_cpu_write_elf32_note, .legacy_vmsd = &vmstate_riscv_cpu, }; #endif @@ -647,8 +649,6 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data) #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = riscv_cpu_get_phys_page_debug; cc->sysemu_ops = &riscv_sysemu_ops; - cc->write_elf64_note = riscv_cpu_write_elf64_note; - cc->write_elf32_note = riscv_cpu_write_elf32_note; #endif cc->gdb_arch_name = riscv_gdb_arch_name; cc->gdb_get_dynamic_xml = riscv_gdb_get_dynamic_xml; diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index d2175a87f5..157ef61d38 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -481,6 +481,7 @@ static void s390_cpu_reset_full(DeviceState *dev) static const struct SysemuCPUOps s390_sysemu_ops = { .get_crash_info = s390_cpu_get_crash_info, + .write_elf64_note = s390_cpu_write_elf64_note, .legacy_vmsd = &vmstate_s390_cpu, }; #endif @@ -525,7 +526,6 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_write_register = s390_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = s390_cpu_get_phys_page_debug; - cc->write_elf64_note = s390_cpu_write_elf64_note; cc->sysemu_ops = &s390_sysemu_ops; #endif cc->disas_set_info = s390_cpu_disas_set_info; From patchwork Wed May 26 23:47:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448338 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp14708jac; Wed, 26 May 2021 16:56:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLio1/PjPyWYMye4xOUhiq6XBJvpfOtTP1zsXWadjoi1d+xnS+W4iZy38wjZ0AcBCAhfab X-Received: by 2002:a0c:fd8d:: with SMTP id p13mr498899qvr.52.1622073405094; Wed, 26 May 2021 16:56:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073405; cv=none; d=google.com; s=arc-20160816; b=Qmv4ZY6YxGkJD/mxVtPsXnW+C916d7pVJu6XC8tRN0sUV2xGeTnXNFy3o6SNQ9vAx5 XsBcZ3Wt4y1DAAvLTkgJmk5Uqbb+P3cJeZFaxd3Y3czb0M+ZzF2W8ad13XuxIAr/KfOa gUWttzvHqQ1BariACVEwnYmSThXtNXiqsLSKxAbh2RkF9sv22mh0KAQELcibjEyDKiSa jNsr3Ji7K4rNGBJZCZtWq7o0JPqHy46BZjx9jj32Dk306W8ZYKDwW2G09u/gdc8+hgmO HIkqlv6Zq8uivBFRn5st7PUGpvbKqlDu/Jq6kJEjgMlq2wr37BidbwqtXxQn0fR8HK9D SulA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=lMwBO3bp6tNg7j75c27UeW2luvwPir3yOOEl1aaTHG4=; b=ZIcPhmsZ4DLtgp0VbNfTU3G11EVnhi7pgoF3MzFCKzJ1XaTtZvRW10Mk5OeeOjP0og 9BqdKYb9fUk9NxzMwtSPlovOVbwHciHuhpxzf0iIGE6Wm9fOU/M6/o2wPbkY71MfUy2C 0sNyPaPOT4JczyKUQp0s46ni5ctnbNVGQWUGNRlqfBkFTXqADHNstg/upRx20Id5Nr5p Mj522kiOewvh63s8zje/lOrP99uIqvkjHUscw40v9IXY+gWmBQkHEmUHGhYQc+JIeFz7 CJ7OHTGhzTvImQ2/onbHmOYObBqVqMWLHsqejtNOS4RnjP5MjdIaylPOMxgHT2jMdf34 B06Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ztGqTZVk; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o13si401715qvh.127.2021.05.26.16.56.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 16:56:45 -0700 (PDT) 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=ztGqTZVk; 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 Received: from localhost ([::1]:53328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3OG-0006sy-DF for patch@linaro.org; Wed, 26 May 2021 19:56:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FX-00060H-6f for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:43 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:45897) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FP-0004bv-5B for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:42 -0400 Received: by mail-pf1-x435.google.com with SMTP id d16so2191403pfn.12 for ; Wed, 26 May 2021 16:47:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lMwBO3bp6tNg7j75c27UeW2luvwPir3yOOEl1aaTHG4=; b=ztGqTZVkVfXQ75JTcWEyDz6/QKF0d5hgH28/BWBMQguHq24OKnPxcehpn7rci1T9Pm 4qRvrBJYPO+dlz8oiWbcDQF7zZo/kppHD/Z8PyF325QiKgGyxlmWffjHM9ltt+LmJNGe Oej5jfK5uNwBj8lYvft9jcPyUW9Lb9v8ZnXPM+/5EkdXUL8U5yrWV36Gz/fYDWHjj490 oF1paLunDlsxuR14/Y1WlyoGNlh/JwB+Aak1bPXNbMJsTYdssgrhHGeGIfYm6zNWEigT jaYanlhAZZqbNv+4+ujmLARox4uMj1keYtv7zNu0m7dY08fA57Keo56MrIs/rHjek+0v SNCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lMwBO3bp6tNg7j75c27UeW2luvwPir3yOOEl1aaTHG4=; b=jUSw8WYOAQFxjg7h+vmOAkRZ0YiJgI4hBZBLKoDrTdU75J0PPuPf9fD0b4tqH5DVGJ 2zGGMxxj7HwErD1QZgpQ5XMA4RuNVD9thZ/HVCwsG9LfA05UAymkfB0ly4mNhPYjzxcB RN1a2VrUFapqUCMCfMOQbbgDXkPdD/oSgI4rD+ntawZFiaMegyh1bJb6VV65I3yFpVWW O7taCvg2hv7quW0ssVa5117FBkJsAioM3x/XZUU1iZWhFpsEHU7100hGOyN5Q4aPULw3 /LT6/3276opRD2XpEH+FZTd05dao729US9B3AovwWaDbloJb6lQU9UoRmUaqUZH1fncv we5g== X-Gm-Message-State: AOAM53311Hy4zHBBzrViC4PSqg+G5C1H+Ul+5iK5yOUT8ADea/U130Pp C32I3V6AFGo4NtkiPQFMiPBEZYUdHEnb9g== X-Received: by 2002:a62:e10e:0:b029:2db:32e7:403f with SMTP id q14-20020a62e10e0000b02902db32e7403fmr925459pfh.61.1622072853854; Wed, 26 May 2021 16:47:33 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 26/31] cpu: Move CPUClass::asidx_from_attrs to SysemuCPUOps Date: Wed, 26 May 2021 16:47:05 -0700 Message-Id: <20210526234710.125396-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-20-f4bug@amsat.org> Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 3 --- include/hw/core/sysemu-cpu-ops.h | 5 +++++ hw/core/cpu-sysemu.c | 4 ++-- target/arm/cpu.c | 2 +- target/i386/cpu.c | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) -- 2.25.1 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 15b16d3f6d..af6246c905 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -109,8 +109,6 @@ struct SysemuCPUOps; * associated memory transaction attributes to use for the access. * CPUs which use memory transaction attributes should implement this * instead of get_phys_page_debug. - * @asidx_from_attrs: Callback to return the CPU AddressSpace to use for - * a memory access with the specified memory transaction attributes. * @gdb_read_register: Callback for letting GDB read a register. * @gdb_write_register: Callback for letting GDB write a register. * @gdb_num_core_regs: Number of core registers accessible to GDB. @@ -152,7 +150,6 @@ struct CPUClass { hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr); hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr, MemTxAttrs *attrs); - int (*asidx_from_attrs)(CPUState *cpu, MemTxAttrs attrs); int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg); int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg); diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h index 52ac0ae4e1..8f8326e810 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -16,6 +16,11 @@ * struct SysemuCPUOps: System operations specific to a CPU class */ typedef struct SysemuCPUOps { + /** + * @asidx_from_attrs: Callback to return the CPU AddressSpace to use for + * a memory access with the specified memory transaction attributes. + */ + int (*asidx_from_attrs)(CPUState *cpu, MemTxAttrs attrs); /** * @get_crash_info: Callback for reporting guest crash information in * GUEST_PANICKED events. diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c index d55ef8d23d..ba53c2eaa8 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -72,8 +72,8 @@ int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs) CPUClass *cc = CPU_GET_CLASS(cpu); int ret = 0; - if (cc->asidx_from_attrs) { - ret = cc->asidx_from_attrs(cpu, attrs); + if (cc->sysemu_ops->asidx_from_attrs) { + ret = cc->sysemu_ops->asidx_from_attrs(cpu, attrs); assert(ret < cpu->num_ases && ret >= 0); } return ret; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 18627cc3c6..85666b765f 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1948,6 +1948,7 @@ static gchar *arm_gdb_arch_name(CPUState *cs) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps arm_sysemu_ops = { + .asidx_from_attrs = arm_asidx_from_attrs, .write_elf32_note = arm_cpu_write_elf32_note, .write_elf64_note = arm_cpu_write_elf64_note, .virtio_is_big_endian = arm_cpu_virtio_is_big_endian, @@ -1993,7 +1994,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_write_register = arm_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug; - cc->asidx_from_attrs = arm_asidx_from_attrs; cc->sysemu_ops = &arm_sysemu_ops; #endif cc->gdb_num_core_regs = 26; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 2ba82921d6..45e7ded0ce 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6718,6 +6718,7 @@ static Property x86_cpu_properties[] = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps i386_sysemu_ops = { + .asidx_from_attrs = x86_asidx_from_attrs, .get_crash_info = x86_cpu_get_crash_info, .write_elf32_note = x86_cpu_write_elf32_note, .write_elf64_note = x86_cpu_write_elf64_note, @@ -6754,7 +6755,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->get_paging_enabled = x86_cpu_get_paging_enabled; #ifndef CONFIG_USER_ONLY - cc->asidx_from_attrs = x86_asidx_from_attrs; cc->get_memory_mapping = x86_cpu_get_memory_mapping; cc->get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug; cc->sysemu_ops = &i386_sysemu_ops; From patchwork Wed May 26 23:47:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448523 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp23243jac; Wed, 26 May 2021 17:09:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDR3jVtA96jHJcA3GmZPa/EDBOoSldvPQYSajFjtloMwawPR8nm3rpqwuYms4rho9lKb9C X-Received: by 2002:a67:fd0a:: with SMTP id f10mr604734vsr.60.1622074181420; Wed, 26 May 2021 17:09:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622074181; cv=none; d=google.com; s=arc-20160816; b=Mk5ghzj6TPBR9Nu/FbxvXr5IgMHSsYT0P+FJ6oUhLeq5E1PNa7xD0Wivf4mrW1+NsF yIkG/ssOIIaW/qWCFAVthS0PCKuZ8FGuqqHCBjm9PoP7n+s8TATi7CReF0+DhO9a5ZId e6N9iMpejB7VXjKw+0UMvt7L9tPlfGZy6Yl1LBiseS7Oe0AffRw9bZR2L37K/dgMni7G DBN3IGHdmSEcAn+sqzNydXUmnOMpS19p1lx6v44QFjCWQNXJf01Xe8C/51iEJnz9jXDu 8rxDHO7D1g+SEMGCshY8It+Dq3bhjcyrYXtdFOB4yBXJjc8RJa1jCq9DgrKU4OsU5yeC nujA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=A904/5E6IstmbNT+iW+VVwsm0qipUns0qSF2YCFkFvk=; b=DRZmYIi+pL7ck9sfUjivneEMbq8BRlC1Wkf7vqONAgAAlYgWNj9+pbeQxtuTvBy9LH EAHCy4K2It+jrNHnRAk4DHFaj42L3hEVbFPKvwG8WqU7yQHvf05fNTDnk07FgGCrYrK5 uDlxL7/2a995Fcj0PdH2emHvrJTK6N1B/URp8Hr75vFA+fnEGmd6rOfit0YpjxM9cnWt zKSleH5GsiC+U7cibUVHIRlb6I2B5FkegnVjNp98TYdjpyHOadKGLhUyMSwI1MvT+I9N 3ilqCOyUB9m+8SFSfi7pQr+brtv4UM8mxRDm9Q3srJcZWJZQdsiRLMAS9cU717aSXuld acdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K1TosUuC; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n14si339318vse.60.2021.05.26.17.09.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 17:09:41 -0700 (PDT) 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=K1TosUuC; 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 Received: from localhost ([::1]:50628 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3am-0007IX-0l for patch@linaro.org; Wed, 26 May 2021 20:09:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FY-000668-FQ for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:44 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:41918) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FQ-0004cd-0v for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:44 -0400 Received: by mail-pf1-x436.google.com with SMTP id p39so2206839pfw.8 for ; Wed, 26 May 2021 16:47:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=A904/5E6IstmbNT+iW+VVwsm0qipUns0qSF2YCFkFvk=; b=K1TosUuC/GFFT8wPU0VgtwVTru6tCCDRtSLFlLnxOf46f2wyu5MeTR1em9V2CUGxbc 0b0YjDoptmksoDmdTcwh+YvZSCENrkW1cwDscXfF3OJPomUTYkVZnNqqaWn0Ds4o4hAR OUs37yIAUxvwiSGN0iTydt9pnlB2/BWa9tQV5Y3f7NE/kh1hZCCZyeUXWWX71Rdrbw4s YFQI2FKF87BuetCbHRmbDbW8KoqG/N+Jeu0VK81ZjEPxAp+pkYgMTw2Ma90uF2aS5tky qgqWxHsDWN9jX9N5qTFyY2/qBIXegibfhUrMC5rkJ6J51rmEYJmyqL1j5oyNoRXWIWn0 GzVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A904/5E6IstmbNT+iW+VVwsm0qipUns0qSF2YCFkFvk=; b=MPuv6zUXQCBCMvC/A08ckZV7RDigxVg4j17PTvuB0O2+4HRT81m8ZzGQbznlop0EjB 2KFPnu5qF55nCbuxDPKpoFADu3UOWqc15bsY8AAQ2gVqEaB0+/2daR+JMY1Oe1aEYaVh JO8z8HzjvsIkCFR0wAs/1yWSaGW4vuokxJTPfsFjgzyPzXb1g1fRspwmShq3JuQRpFbm Rxs4553//v7UotP7WfCX5a9LnVo0Kqi/WQEwtVrzb4Wtc+5esSIGkZ+AGYcuKO9aQ4fc MGHIFzF7olmWJkdwDdY7E0dJaf06KDH2PwIUYLDeVhQ+iBG0CVufoL6DkqU+O4jzMySq FPFw== X-Gm-Message-State: AOAM532mFbAXhPtCbIdabKEeintt8F4kN/2mBO+gkqzo13b6U+C15iu9 VoRqpWy1mvgGF+CPksV4CQuwKvSXUEeAxQ== X-Received: by 2002:a62:8705:0:b029:2d9:5420:a1b5 with SMTP id i5-20020a6287050000b02902d95420a1b5mr904462pfe.45.1622072854551; Wed, 26 May 2021 16:47:34 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 27/31] cpu: Move CPUClass::get_phys_page_debug to SysemuCPUOps Date: Wed, 26 May 2021 16:47:06 -0700 Message-Id: <20210526234710.125396-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-21-f4bug@amsat.org> [rth: Drop declaration movement from target/*/cpu.h] Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 8 -------- include/hw/core/sysemu-cpu-ops.h | 13 +++++++++++++ hw/core/cpu-sysemu.c | 6 +++--- target/alpha/cpu.c | 2 +- target/arm/cpu.c | 2 +- target/avr/cpu.c | 2 +- target/cris/cpu.c | 2 +- target/hppa/cpu.c | 2 +- target/i386/cpu.c | 2 +- target/m68k/cpu.c | 2 +- target/microblaze/cpu.c | 2 +- target/mips/cpu.c | 2 +- target/nios2/cpu.c | 2 +- target/openrisc/cpu.c | 2 +- target/ppc/cpu_init.c | 2 +- target/riscv/cpu.c | 2 +- target/rx/cpu.c | 2 +- target/s390x/cpu.c | 2 +- target/sh4/cpu.c | 2 +- target/sparc/cpu.c | 2 +- target/tricore/cpu.c | 2 +- target/xtensa/cpu.c | 2 +- 22 files changed, 35 insertions(+), 30 deletions(-) -- 2.25.1 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index af6246c905..405d1f367f 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -104,11 +104,6 @@ struct SysemuCPUOps; * If the target behaviour here is anything other than "set * the PC register to the value passed in" then the target must * also implement the synchronize_from_tb hook. - * @get_phys_page_debug: Callback for obtaining a physical address. - * @get_phys_page_attrs_debug: Callback for obtaining a physical address and the - * associated memory transaction attributes to use for the access. - * CPUs which use memory transaction attributes should implement this - * instead of get_phys_page_debug. * @gdb_read_register: Callback for letting GDB read a register. * @gdb_write_register: Callback for letting GDB write a register. * @gdb_num_core_regs: Number of core registers accessible to GDB. @@ -147,9 +142,6 @@ struct CPUClass { void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list, Error **errp); void (*set_pc)(CPUState *cpu, vaddr value); - hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr); - hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr, - MemTxAttrs *attrs); int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg); int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg); diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h index 8f8326e810..1f249e0f06 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -16,6 +16,19 @@ * struct SysemuCPUOps: System operations specific to a CPU class */ typedef struct SysemuCPUOps { + /** + * @get_phys_page_debug: Callback for obtaining a physical address. + */ + hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr); + /** + * @get_phys_page_attrs_debug: Callback for obtaining a physical address + * and the associated memory transaction attributes to use for the + * access. + * CPUs which use memory transaction attributes should implement this + * instead of get_phys_page_debug. + */ + hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr, + MemTxAttrs *attrs); /** * @asidx_from_attrs: Callback to return the CPU AddressSpace to use for * a memory access with the specified memory transaction attributes. diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c index ba53c2eaa8..b31c33ad2b 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -52,12 +52,12 @@ hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, { CPUClass *cc = CPU_GET_CLASS(cpu); - if (cc->get_phys_page_attrs_debug) { - return cc->get_phys_page_attrs_debug(cpu, addr, attrs); + if (cc->sysemu_ops->get_phys_page_attrs_debug) { + return cc->sysemu_ops->get_phys_page_attrs_debug(cpu, addr, attrs); } /* Fallback for CPUs which don't implement the _attrs_ hook */ *attrs = MEMTXATTRS_UNSPECIFIED; - return cc->get_phys_page_debug(cpu, addr); + return cc->sysemu_ops->get_phys_page_debug(cpu, addr); } hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr) diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index 0b12b2be81..7687d5a09a 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -210,6 +210,7 @@ static void alpha_cpu_initfn(Object *obj) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps alpha_sysemu_ops = { + .get_phys_page_debug = alpha_cpu_get_phys_page_debug, }; #endif @@ -243,7 +244,6 @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_read_register = alpha_cpu_gdb_read_register; cc->gdb_write_register = alpha_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY - cc->get_phys_page_debug = alpha_cpu_get_phys_page_debug; dc->vmsd = &vmstate_alpha_cpu; cc->sysemu_ops = &alpha_sysemu_ops; #endif diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 85666b765f..2d9b32ec92 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1948,6 +1948,7 @@ static gchar *arm_gdb_arch_name(CPUState *cs) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps arm_sysemu_ops = { + .get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug, .asidx_from_attrs = arm_asidx_from_attrs, .write_elf32_note = arm_cpu_write_elf32_note, .write_elf64_note = arm_cpu_write_elf64_note, @@ -1993,7 +1994,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_read_register = arm_cpu_gdb_read_register; cc->gdb_write_register = arm_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY - cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug; cc->sysemu_ops = &arm_sysemu_ops; #endif cc->gdb_num_core_regs = 26; diff --git a/target/avr/cpu.c b/target/avr/cpu.c index b95caf8c0f..7551bca3a6 100644 --- a/target/avr/cpu.c +++ b/target/avr/cpu.c @@ -187,6 +187,7 @@ static void avr_cpu_dump_state(CPUState *cs, FILE *f, int flags) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps avr_sysemu_ops = { + .get_phys_page_debug = avr_cpu_get_phys_page_debug, }; #include "hw/core/tcg-cpu-ops.h" @@ -217,7 +218,6 @@ static void avr_cpu_class_init(ObjectClass *oc, void *data) cc->dump_state = avr_cpu_dump_state; cc->set_pc = avr_cpu_set_pc; cc->memory_rw_debug = avr_cpu_memory_rw_debug; - cc->get_phys_page_debug = avr_cpu_get_phys_page_debug; dc->vmsd = &vms_avr_cpu; cc->sysemu_ops = &avr_sysemu_ops; cc->disas_set_info = avr_cpu_disas_set_info; diff --git a/target/cris/cpu.c b/target/cris/cpu.c index f1095fcf5c..9cb4f817b4 100644 --- a/target/cris/cpu.c +++ b/target/cris/cpu.c @@ -197,6 +197,7 @@ static void cris_cpu_initfn(Object *obj) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps cris_sysemu_ops = { + .get_phys_page_debug = cris_cpu_get_phys_page_debug, }; #endif @@ -299,7 +300,6 @@ static void cris_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_read_register = cris_cpu_gdb_read_register; cc->gdb_write_register = cris_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY - cc->get_phys_page_debug = cris_cpu_get_phys_page_debug; dc->vmsd = &vmstate_cris_cpu; cc->sysemu_ops = &cris_sysemu_ops; #endif diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 870130b159..4018e3ad90 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -135,6 +135,7 @@ static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps hppa_sysemu_ops = { + .get_phys_page_debug = hppa_cpu_get_phys_page_debug, }; #endif @@ -168,7 +169,6 @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_read_register = hppa_cpu_gdb_read_register; cc->gdb_write_register = hppa_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY - cc->get_phys_page_debug = hppa_cpu_get_phys_page_debug; dc->vmsd = &vmstate_hppa_cpu; cc->sysemu_ops = &hppa_sysemu_ops; #endif diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 45e7ded0ce..de212a939d 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6718,6 +6718,7 @@ static Property x86_cpu_properties[] = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps i386_sysemu_ops = { + .get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug, .asidx_from_attrs = x86_asidx_from_attrs, .get_crash_info = x86_cpu_get_crash_info, .write_elf32_note = x86_cpu_write_elf32_note, @@ -6756,7 +6757,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) #ifndef CONFIG_USER_ONLY cc->get_memory_mapping = x86_cpu_get_memory_mapping; - cc->get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug; cc->sysemu_ops = &i386_sysemu_ops; #endif /* !CONFIG_USER_ONLY */ diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 97ef3ae31c..4238775d5e 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -507,6 +507,7 @@ static const VMStateDescription vmstate_m68k_cpu = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps m68k_sysemu_ops = { + .get_phys_page_debug = m68k_cpu_get_phys_page_debug, }; #endif @@ -540,7 +541,6 @@ static void m68k_cpu_class_init(ObjectClass *c, void *data) cc->gdb_read_register = m68k_cpu_gdb_read_register; cc->gdb_write_register = m68k_cpu_gdb_write_register; #if defined(CONFIG_SOFTMMU) - cc->get_phys_page_debug = m68k_cpu_get_phys_page_debug; dc->vmsd = &vmstate_m68k_cpu; cc->sysemu_ops = &m68k_sysemu_ops; #endif diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 96f221ff71..8f88f2afb9 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -356,6 +356,7 @@ static ObjectClass *mb_cpu_class_by_name(const char *cpu_model) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps mb_sysemu_ops = { + .get_phys_page_attrs_debug = mb_cpu_get_phys_page_attrs_debug, }; #endif @@ -393,7 +394,6 @@ static void mb_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_write_register = mb_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY - cc->get_phys_page_attrs_debug = mb_cpu_get_phys_page_attrs_debug; dc->vmsd = &vmstate_mb_cpu; cc->sysemu_ops = &mb_sysemu_ops; #endif diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 7aa3f3ecf5..7275f64eab 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -525,6 +525,7 @@ static Property mips_cpu_properties[] = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps mips_sysemu_ops = { + .get_phys_page_debug = mips_cpu_get_phys_page_debug, .legacy_vmsd = &vmstate_mips_cpu, }; #endif @@ -568,7 +569,6 @@ static void mips_cpu_class_init(ObjectClass *c, void *data) cc->gdb_read_register = mips_cpu_gdb_read_register; cc->gdb_write_register = mips_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY - cc->get_phys_page_debug = mips_cpu_get_phys_page_debug; cc->sysemu_ops = &mips_sysemu_ops; #endif cc->disas_set_info = mips_cpu_disas_set_info; diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c index cb04b04d24..afcd776746 100644 --- a/target/nios2/cpu.c +++ b/target/nios2/cpu.c @@ -211,6 +211,7 @@ static Property nios2_properties[] = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps nios2_sysemu_ops = { + .get_phys_page_debug = nios2_cpu_get_phys_page_debug, }; #endif @@ -244,7 +245,6 @@ static void nios2_cpu_class_init(ObjectClass *oc, void *data) cc->set_pc = nios2_cpu_set_pc; cc->disas_set_info = nios2_cpu_disas_set_info; #ifndef CONFIG_USER_ONLY - cc->get_phys_page_debug = nios2_cpu_get_phys_page_debug; cc->sysemu_ops = &nios2_sysemu_ops; #endif cc->gdb_read_register = nios2_cpu_gdb_read_register; diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index 12d9173043..d8e80b81a2 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -178,6 +178,7 @@ static void openrisc_any_initfn(Object *obj) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps openrisc_sysemu_ops = { + .get_phys_page_debug = openrisc_cpu_get_phys_page_debug, }; #endif @@ -210,7 +211,6 @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_read_register = openrisc_cpu_gdb_read_register; cc->gdb_write_register = openrisc_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY - cc->get_phys_page_debug = openrisc_cpu_get_phys_page_debug; dc->vmsd = &vmstate_openrisc_cpu; cc->sysemu_ops = &openrisc_sysemu_ops; #endif diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 16d966696b..1afa29e338 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -9267,6 +9267,7 @@ static Property ppc_cpu_properties[] = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps ppc_sysemu_ops = { + .get_phys_page_debug = ppc_cpu_get_phys_page_debug, .write_elf32_note = ppc32_cpu_write_elf32_note, .write_elf64_note = ppc64_cpu_write_elf64_note, .virtio_is_big_endian = ppc_cpu_is_big_endian, @@ -9315,7 +9316,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_read_register = ppc_cpu_gdb_read_register; cc->gdb_write_register = ppc_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY - cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug; cc->sysemu_ops = &ppc_sysemu_ops; #endif diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 80cee005a3..9775d8ca5c 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -600,6 +600,7 @@ static const char *riscv_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps riscv_sysemu_ops = { + .get_phys_page_debug = riscv_cpu_get_phys_page_debug, .write_elf64_note = riscv_cpu_write_elf64_note, .write_elf32_note = riscv_cpu_write_elf32_note, .legacy_vmsd = &vmstate_riscv_cpu, @@ -647,7 +648,6 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data) cc->gdb_stop_before_watchpoint = true; cc->disas_set_info = riscv_cpu_disas_set_info; #ifndef CONFIG_USER_ONLY - cc->get_phys_page_debug = riscv_cpu_get_phys_page_debug; cc->sysemu_ops = &riscv_sysemu_ops; #endif cc->gdb_arch_name = riscv_gdb_arch_name; diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 98e6596158..e575669ad1 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -177,6 +177,7 @@ static void rx_cpu_init(Object *obj) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps rx_sysemu_ops = { + .get_phys_page_debug = rx_cpu_get_phys_page_debug, }; #endif @@ -214,7 +215,6 @@ static void rx_cpu_class_init(ObjectClass *klass, void *data) #endif cc->gdb_read_register = rx_cpu_gdb_read_register; cc->gdb_write_register = rx_cpu_gdb_write_register; - cc->get_phys_page_debug = rx_cpu_get_phys_page_debug; cc->disas_set_info = rx_cpu_disas_set_info; cc->gdb_num_core_regs = 26; diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 157ef61d38..bd5070c783 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -480,6 +480,7 @@ static void s390_cpu_reset_full(DeviceState *dev) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps s390_sysemu_ops = { + .get_phys_page_debug = s390_cpu_get_phys_page_debug, .get_crash_info = s390_cpu_get_crash_info, .write_elf64_note = s390_cpu_write_elf64_note, .legacy_vmsd = &vmstate_s390_cpu, @@ -525,7 +526,6 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_read_register = s390_cpu_gdb_read_register; cc->gdb_write_register = s390_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY - cc->get_phys_page_debug = s390_cpu_get_phys_page_debug; cc->sysemu_ops = &s390_sysemu_ops; #endif cc->disas_set_info = s390_cpu_disas_set_info; diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 79aec898fa..1d5a715631 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -227,6 +227,7 @@ static const VMStateDescription vmstate_sh_cpu = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps sh4_sysemu_ops = { + .get_phys_page_debug = superh_cpu_get_phys_page_debug, }; #endif @@ -263,7 +264,6 @@ static void superh_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_read_register = superh_cpu_gdb_read_register; cc->gdb_write_register = superh_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY - cc->get_phys_page_debug = superh_cpu_get_phys_page_debug; cc->sysemu_ops = &sh4_sysemu_ops; dc->vmsd = &vmstate_sh_cpu; #endif diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index ffe85a7f59..ff950fb307 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -852,6 +852,7 @@ static Property sparc_cpu_properties[] = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps sparc_sysemu_ops = { + .get_phys_page_debug = sparc_cpu_get_phys_page_debug, .legacy_vmsd = &vmstate_sparc_cpu, }; #endif @@ -896,7 +897,6 @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_read_register = sparc_cpu_gdb_read_register; cc->gdb_write_register = sparc_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY - cc->get_phys_page_debug = sparc_cpu_get_phys_page_debug; cc->sysemu_ops = &sparc_sysemu_ops; #endif cc->disas_set_info = cpu_sparc_disas_set_info; diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index 7dc6aab66c..ff17d1cecd 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -145,6 +145,7 @@ static void tc27x_initfn(Object *obj) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps tricore_sysemu_ops = { + .get_phys_page_debug = tricore_cpu_get_phys_page_debug, }; #include "hw/core/tcg-cpu-ops.h" @@ -175,7 +176,6 @@ static void tricore_cpu_class_init(ObjectClass *c, void *data) cc->dump_state = tricore_cpu_dump_state; cc->set_pc = tricore_cpu_set_pc; - cc->get_phys_page_debug = tricore_cpu_get_phys_page_debug; cc->sysemu_ops = &tricore_sysemu_ops; cc->tcg_ops = &tricore_tcg_ops; } diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index a196530451..da4dbecdf1 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -184,6 +184,7 @@ static const VMStateDescription vmstate_xtensa_cpu = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps xtensa_sysemu_ops = { + .get_phys_page_debug = xtensa_cpu_get_phys_page_debug, }; #endif @@ -222,7 +223,6 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_stop_before_watchpoint = true; #ifndef CONFIG_USER_ONLY cc->sysemu_ops = &xtensa_sysemu_ops; - cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug; dc->vmsd = &vmstate_xtensa_cpu; #endif cc->disas_set_info = xtensa_cpu_disas_set_info; From patchwork Wed May 26 23:47:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448813 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp32673jac; Wed, 26 May 2021 17:26:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2vIhlgX0qDSnMSBP/Ac9jJbGP8R4XlnOmyverLeJ17jivzVWTVier7prXUIjp5+S0JnPi X-Received: by 2002:ab0:f5:: with SMTP id 108mr412782uaj.106.1622075170937; Wed, 26 May 2021 17:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622075170; cv=none; d=google.com; s=arc-20160816; b=VTf4T4iZeD8jUc+hjzsnj5USiifhMrD5aabI53jTQl892utDGSr6yPJhP7PTiuH1WN /LF5HgwUBkyPQiqarnSlzPXeeXXyDggc+rGJrhMTCTnC1p5AMHq6FU7UBh/6XHjVTw2q hjQhyAHBSyEAugsdrBM4xlVzmUakdhlXjyaJRnjKZGnutYiso5tI4UZDKBgHKPaEXMXS oijODqGyyslUdMi1r0QXDFvK714JeYcts/p+omfJS7Wi1o22csn8popeTOC3TRDTMgj/ BSGJS7aCBsgIs6X2CDenvFmzOuH7hSwFdW21RBzxZGtTiGDB58oq9qmCe+tTu+Jz+das yHaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=wdKqjgVc8k1VtRKWlpH/KMPYr5BtQruarC7LkdFcPVk=; b=GlZnQhwlg0GH0D3FnfrfVvaloy92bwtNrceZSVwkMMk7BJegkroi8LQ3IT1oqGNfhl 8XlOGQzzFqBunxi4lD9layoqCcZYUgQCwG7/KcMrJjKpcIIaZ8ur4D1a7aTZ1x3iCiIH uUf5/2gQ7DGRYfBRVkUNZekDAQ4qrbxO3YNOCge0W8f/cJKV9+2D5DVBxF7tZAIT/1ru oKmy94KIiGD8AJrkapFo3L+t37or3SviQblaNfw8lKDv6Tv83lE0elPg+3VZZrNkVVV7 jKs8eohBdtt6QvaDVY7GxNVKx4I9BaXdGugrg/UPdq8wWAgkHpwuyy26aQyB1PkIWqAw iMAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=In+USBX8; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d3si306040vsl.229.2021.05.26.17.26.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 17:26:10 -0700 (PDT) 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=In+USBX8; 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 Received: from localhost ([::1]:40998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3qk-00043F-Bv for patch@linaro.org; Wed, 26 May 2021 20:26:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35054) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3Fe-00068Q-DI for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:56 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:45010) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FQ-0004cn-Ks for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:48 -0400 Received: by mail-pf1-x433.google.com with SMTP id 22so2197247pfv.11 for ; Wed, 26 May 2021 16:47:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wdKqjgVc8k1VtRKWlpH/KMPYr5BtQruarC7LkdFcPVk=; b=In+USBX8lk9SWnWSvkemytgVYNepa+KWAZvv6mBf30hNENUGifkhRd159lPHwW94YB 4LsZtx2ims+t8EbcRnb8Y9/g4+ifzZPLAcD/yvJVZlTBM/tF3H0dgimqc4zWcakkukaC IuslW6IwXm+f6ZhjzQBgYfwPtaAOoiW30mr+clp+kzjKRT8uXv2yYyWVzSSbloVfrEBt 1aUyMEhyX8iM8e3LYs8NFa2tHrtoZl+pLSw4NalhzcGEWq7VmD04nIx27Yvrr6ZTo/bs YiX7/eWq5TgJI5ecmx3dp7wVK87AQK3jpa1p4Pwddhkx1/sdlOcgqsRA7KKpjcCYQ15D DwiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wdKqjgVc8k1VtRKWlpH/KMPYr5BtQruarC7LkdFcPVk=; b=b6YOtl1iXjBKrjsuGfnyo7+39qCiHFFgvLoxbJ9gx6h69/OgMDa6TAfWkg+cJGR69F BJuVfeXCketjBomA5JMeYtpuKEThcGKvrGS7FBf2MTyVk6hHIyi+creZaLjgC1qQDRSb sIyg/etkbI4mzRkkJdu2E0PRV8Ng5BV+ZUEgPRMLUy27tfXOx3Fymx01c/4AqK4Sbxtr ARbkpCoqvRbMassLZgmiP5tIIKAT8XGUlAnxHQBvQifNXslkQsSr44U5LAywC5bTZFaj 1u0jcWziTwOJ9b6pqTSjUkrMb5EXiks/s4Nwyh7MJkcBj/zJAk85PZ31usukWtZW2c9O KVKQ== X-Gm-Message-State: AOAM532G8XfhPJgTLO+NKOnQ7T/s/WYG+oT9uaHQgQmsS9bKh2bdqqCP v9d3eb/BqmZP/FvgQHyDfcCGMKLgNw6gQQ== X-Received: by 2002:a65:4608:: with SMTP id v8mr977154pgq.435.1622072855215; Wed, 26 May 2021 16:47:35 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 28/31] cpu: Move CPUClass::get_memory_mapping to SysemuCPUOps Date: Wed, 26 May 2021 16:47:07 -0700 Message-Id: <20210526234710.125396-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-22-f4bug@amsat.org> Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 3 --- include/hw/core/sysemu-cpu-ops.h | 5 +++++ hw/core/cpu-sysemu.c | 4 ++-- target/i386/cpu.c | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 405d1f367f..4f6dd24112 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -95,7 +95,6 @@ struct SysemuCPUOps; * @dump_statistics: Callback for dumping statistics. * @get_arch_id: Callback for getting architecture-dependent CPU ID. * @get_paging_enabled: Callback for inquiring whether paging is enabled. - * @get_memory_mapping: Callback for obtaining the memory mappings. * @set_pc: Callback for setting the Program Counter register. This * should have the semantics used by the target architecture when * setting the PC from a source such as an ELF file entry point; @@ -139,8 +138,6 @@ struct CPUClass { void (*dump_statistics)(CPUState *cpu, int flags); int64_t (*get_arch_id)(CPUState *cpu); bool (*get_paging_enabled)(const CPUState *cpu); - void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list, - Error **errp); void (*set_pc)(CPUState *cpu, vaddr value); int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg); int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg); diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h index 1f249e0f06..213e5287ab 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -16,6 +16,11 @@ * struct SysemuCPUOps: System operations specific to a CPU class */ typedef struct SysemuCPUOps { + /** + * @get_memory_mapping: Callback for obtaining the memory mappings. + */ + void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list, + Error **errp); /** * @get_phys_page_debug: Callback for obtaining a physical address. */ diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c index b31c33ad2b..3850fcb27f 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -39,8 +39,8 @@ void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list, { CPUClass *cc = CPU_GET_CLASS(cpu); - if (cc->get_memory_mapping) { - cc->get_memory_mapping(cpu, list, errp); + if (cc->sysemu_ops->get_memory_mapping) { + cc->sysemu_ops->get_memory_mapping(cpu, list, errp); return; } diff --git a/target/i386/cpu.c b/target/i386/cpu.c index de212a939d..d400feec8f 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6718,6 +6718,7 @@ static Property x86_cpu_properties[] = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps i386_sysemu_ops = { + .get_memory_mapping = x86_cpu_get_memory_mapping, .get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug, .asidx_from_attrs = x86_asidx_from_attrs, .get_crash_info = x86_cpu_get_crash_info, @@ -6756,7 +6757,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->get_paging_enabled = x86_cpu_get_paging_enabled; #ifndef CONFIG_USER_ONLY - cc->get_memory_mapping = x86_cpu_get_memory_mapping; cc->sysemu_ops = &i386_sysemu_ops; #endif /* !CONFIG_USER_ONLY */ From patchwork Wed May 26 23:47:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448377 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp16552jac; Wed, 26 May 2021 17:00:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsF39tBUXxaUWJADON+VuXc49p5LWZIhBuEY2bVYSh7HUYZu+tSFTtmtgYcV0HUw6Euk5+ X-Received: by 2002:ac8:5d01:: with SMTP id f1mr684705qtx.105.1622073608927; Wed, 26 May 2021 17:00:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073608; cv=none; d=google.com; s=arc-20160816; b=DOQXlxN0uhCeqHdwkZTRlMSzFWkoHe5SZahuxMwlrfuNa4LLQ6PtziunJQ8rIggFUH 9/XtxWZ05sDzgMH3XwSPZ4qyoctG1Zw1LshKTqFClz40010X+LTpSkVMpGktauRF7dZV 3Sbtpl9UCJFVPS/LWinOnIVOocoqC7GzNMJqCKRfP414NTmBJFNHrRjJ5IVD3p2f1uKa dyBQeAfRNa5GDGFHk6cRdaaCx+Qtm8OmkJXRSfOUcpfT0fxJNoer9PeusIPxQvn60c9k 6goVbPBlxNHTG4rCPJzz4DcfZhHsh32r8PuzV5YjY6Y//gkkuuebX/TOk3hr7ZHiqmt4 B6Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=q34u+TqxTDTJkPHH4qaEih5rVqpqwrjejSIKV+3eh1g=; b=XqUBkCTuWIdalcbgm8aiImyKH+HsVg7AP18374Kmzw77jJHDfI3QLfiWeXKvA7PUBp WSm8TvdJ9oB4Mj1OVcLQMlAAhxBDca/KV0wxnmi1DbpTod8rzSmTtKXV3vMp0JL69cez vqlMvYMs/c6av4MZtbA5ly2XV+7M+/yc0R+O5s0W/5iSE4hm6vGWAoqQWBw/5Jz+EJJe ZUXUrvEFyfnm/qcwh07tRHmxI5Z+G1ke6sHZbeqgZ9Hxp+FC5wV65l/BcTme0kl7wCuV KmjVSKNrupdPLegz7Si2uYrAZRkJmUMtWOVdW38FCbwihT96dQzgiw0VL1keA+IZbyQx tPTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LzzoIrV6; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 8si285731qkd.100.2021.05.26.17.00.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 17:00:08 -0700 (PDT) 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=LzzoIrV6; 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 Received: from localhost ([::1]:33716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3RY-0004D5-7e for patch@linaro.org; Wed, 26 May 2021 20:00:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3Fg-00068l-Q3 for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:56 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:35807) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FU-0004dG-Or for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:51 -0400 Received: by mail-pf1-x436.google.com with SMTP id g18so2220810pfr.2 for ; Wed, 26 May 2021 16:47:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=q34u+TqxTDTJkPHH4qaEih5rVqpqwrjejSIKV+3eh1g=; b=LzzoIrV6ZHodTidA9Ylnb1WWt4YBoVZL1dJD3P2oWgiUTfbVxcxlS/ONg0pJmpOkxU uzRyrsN3wQb7Y97cNExrHzp1SbGbbKUVuQRZv0bvWP0vTRykg2rzILW6fodvAQBGjVu/ fRTqRQzTv+c9HaGSAqNb11OOJCN7UAKbNYIjrnkMfKvjR7aLukKYLOodS09y1TnwgBqK ElGD4EjTjyoG6fy9NiWoVaHiAX0KolPhpbRqwvW5JbbmUoQFK+7wk6QhpmpMCBgOt7g5 42JVrsu39YddcA3qDX6GA0ow9bh/+Y44S12MzNhmnKahq+tHZKThN6THRBkmG9tNbcpR c3bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=q34u+TqxTDTJkPHH4qaEih5rVqpqwrjejSIKV+3eh1g=; b=BiCQLKlcQu6/7Haj43+R6FKUAq1qnP4kw51bDApXet9U2fe1MyqduOpOK5lXdxAh+j 06vH4G7kOmLeWJx36sSS1q9HnBNEvSHR0ERJwaXBhWzL3upKwY8KP6MoypfyvJWKV2eC cP02/Rsy/N3l8Vm4dYR+M49ifRw0Zk/dmuq1ctiGgzKEWq8ogXamIPvPwxkcKTTIX4gK 0f9nfaWeXzAfqgLKuO3kdjN18mBOrHKQW+PPR1/S001O6vmCnl4O06gkQE4OqQYCflmo nj98bqS+a1VbZCEA1/q+8EDIRrapcP7ZC2MNFfmq5FdpaFx1wpUtuUXsOYLXdBrDE8ZW 8fqg== X-Gm-Message-State: AOAM530NZnhVdIS0IJL8Shsihm1pHiCkfQ638XrxZ2Zv7pVvPuZ4EtSc jhoa4e4j6DESiuPzbkfBa8zVuyg2Y83MDQ== X-Received: by 2002:a63:617:: with SMTP id 23mr976042pgg.409.1622072855861; Wed, 26 May 2021 16:47:35 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 29/31] cpu: Move CPUClass::get_paging_enabled to SysemuCPUOps Date: Wed, 26 May 2021 16:47:08 -0700 Message-Id: <20210526234710.125396-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-23-f4bug@amsat.org> Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 2 -- include/hw/core/sysemu-cpu-ops.h | 4 ++++ hw/core/cpu-sysemu.c | 4 ++-- target/i386/cpu.c | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) -- 2.25.1 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 4f6dd24112..e4328de8d4 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -94,7 +94,6 @@ struct SysemuCPUOps; * @dump_state: Callback for dumping state. * @dump_statistics: Callback for dumping statistics. * @get_arch_id: Callback for getting architecture-dependent CPU ID. - * @get_paging_enabled: Callback for inquiring whether paging is enabled. * @set_pc: Callback for setting the Program Counter register. This * should have the semantics used by the target architecture when * setting the PC from a source such as an ELF file entry point; @@ -137,7 +136,6 @@ struct CPUClass { void (*dump_state)(CPUState *cpu, FILE *, int flags); void (*dump_statistics)(CPUState *cpu, int flags); int64_t (*get_arch_id)(CPUState *cpu); - bool (*get_paging_enabled)(const CPUState *cpu); void (*set_pc)(CPUState *cpu, vaddr value); int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg); int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg); diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h index 213e5287ab..a9ba39e5f2 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -21,6 +21,10 @@ typedef struct SysemuCPUOps { */ void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list, Error **errp); + /** + * @get_paging_enabled: Callback for inquiring whether paging is enabled. + */ + bool (*get_paging_enabled)(const CPUState *cpu); /** * @get_phys_page_debug: Callback for obtaining a physical address. */ diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c index 3850fcb27f..00253f8929 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -27,8 +27,8 @@ bool cpu_paging_enabled(const CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); - if (cc->get_paging_enabled) { - return cc->get_paging_enabled(cpu); + if (cc->sysemu_ops->get_paging_enabled) { + return cc->sysemu_ops->get_paging_enabled(cpu); } return false; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index d400feec8f..744afc0ff2 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6485,12 +6485,14 @@ static int64_t x86_cpu_get_arch_id(CPUState *cs) return cpu->apic_id; } +#if !defined(CONFIG_USER_ONLY) static bool x86_cpu_get_paging_enabled(const CPUState *cs) { X86CPU *cpu = X86_CPU(cs); return cpu->env.cr[0] & CR0_PG_MASK; } +#endif /* !CONFIG_USER_ONLY */ static void x86_cpu_set_pc(CPUState *cs, vaddr value) { @@ -6719,6 +6721,7 @@ static Property x86_cpu_properties[] = { static const struct SysemuCPUOps i386_sysemu_ops = { .get_memory_mapping = x86_cpu_get_memory_mapping, + .get_paging_enabled = x86_cpu_get_paging_enabled, .get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug, .asidx_from_attrs = x86_asidx_from_attrs, .get_crash_info = x86_cpu_get_crash_info, @@ -6754,7 +6757,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->gdb_read_register = x86_cpu_gdb_read_register; cc->gdb_write_register = x86_cpu_gdb_write_register; cc->get_arch_id = x86_cpu_get_arch_id; - cc->get_paging_enabled = x86_cpu_get_paging_enabled; #ifndef CONFIG_USER_ONLY cc->sysemu_ops = &i386_sysemu_ops; From patchwork Wed May 26 23:47:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448814 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp33480jac; Wed, 26 May 2021 17:27:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkNtjJSK8SzX70Sh8j7aSHMLc4eTkApQ5KdCanCJjhR3UeuG8h8z7Tn/91fdRLbWxSSip3 X-Received: by 2002:a05:620a:24cf:: with SMTP id m15mr767704qkn.435.1622075274291; Wed, 26 May 2021 17:27:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622075274; cv=none; d=google.com; s=arc-20160816; b=O2uW4+xuVCVOzu7y/5K2q3Tzs7pFhiMIavF+5Uw8L0pQC/xtsZkfnSvSUlSHpdzznJ fdu+EnyFrB8c9bj9nY6PunZjVqCtphA1J5RjWd6MRLEDkrnpaeXrx+mh0w+E+j+2rKFA 9Hl0PA1Q3nqTxQh0Ozu2tinuxbFF+KnnNjzcYyR5dLlS+LmaV1toMr+t2+K7JRP2OhMs vFcaSQzJzhkgYUnW1LUOFcwN9WkeVnwNR1YYbRMGr4L/p/IPmf3DByNeyiO6zGKmA27G Dy1OXfN/bvAMl9zwrrBgRgMIAOoslP52HZMcct6elXYMWqMlNss1ZyJmMhORZGqWwVqp qvbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=KggNdH/EFsJ3T1kmCx5Td3eZBoTdhzd36Y4s4qQekSU=; b=QON7d7teEuldtv461GiTxaMXd6J9C9fkJHXdeHcnQLbecGIVgOR6sYbX/Ap6V5Ltwb IgdV58I37Kjs7ytFswSTn0RsVnV2MBYbHB9aRUa6Psugppx+q9nWW7fw1dsQYyc3C9hQ AfcHx+bLrI0v946zZNJIuSTUqTXzsxEdE4MTyY8jtr8/2Cr29FEAkoSXsPymmmpmUxcO QoMwbigDRNCJCC7HMNoReMU+giM8NGWDZzt+rCtZgllcOVySrfSbqjvGDn2KRk5ycUu/ Dr5vu8qTFQJrKb3UWUnOUwzNiXXsLy8uDp1pkp8dMHpkRh3IjBnXOSruTwgnkWtkk+r7 LdPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=arbrUCu7; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y8si484978qto.186.2021.05.26.17.27.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 17:27:54 -0700 (PDT) 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=arbrUCu7; 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 Received: from localhost ([::1]:43600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3sP-0005sn-Oy for patch@linaro.org; Wed, 26 May 2021 20:27:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3Ff-00068R-2p for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:56 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:46774) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FU-0004e6-Ov for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:50 -0400 Received: by mail-pf1-x431.google.com with SMTP id y15so2194350pfn.13 for ; Wed, 26 May 2021 16:47:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KggNdH/EFsJ3T1kmCx5Td3eZBoTdhzd36Y4s4qQekSU=; b=arbrUCu7Zshk+oAH4EDP9DYGwWaQV9VYDzeVS/oA3sK9I35yEhihDSJ66nG8KRDPyf 9UMICYeDBLbckwpHxFdtOLX2foVeAy60VrM5YGvNc/iVsIv1wqlhWd03OnPDceU/RgS9 r0EcGE5oLVGQLtq2Ud7Z/oKFkqqV6A6PgOAcitt4VSGkxZFYj2agDYk2XCUiAy2N7klj c4EcEBkzAVPdLLntTDn+s7QX2F4Aql/70IPJzi3cJv1FRaM9cVcHjIaEjvxO2/c/2HNQ r9jB2sfLfeEFYnFDpcpSwOsULsuxbgvzxgYGtT8RkDr9PR7mJjWTlwTFgVkrZUAYDitu jbng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KggNdH/EFsJ3T1kmCx5Td3eZBoTdhzd36Y4s4qQekSU=; b=IDu0HBCMnLfjxvvlBq9IF0CYGkvGoK1xV3MgcGCR0BuFe59zGAicms4MYUEz8QI1Vp UDP4JBPFYrzF2O0qU4pRkvCea5vSRJ6barJffhY8a92F4ymo17eiM1wLjwA+QE/mCqIS YsenTnTQYtB1je1XDt2hWLS4SgeJw1U+ppsRYnKbZLuOAxTmnm1q9mlCV7cv8ifdSLIP UHesObKMN12dXt/C0ce1O5aXgi4QAW9B4Y/g8rkPNy9f73kIkW5F/nOyaNFERqbViTzJ LziFycYzAJJLVpZd+TBBeKnUSrVLymmYIE+96W4/CZ9z4Q4Q9+Goo2QpkbqH3w/efk5H LqbA== X-Gm-Message-State: AOAM533LQOt2HoJ26jopHAifnLNHJVNDmU8h4kIOs2BDmbXYlCfPMDCr eoeT7os30VVyoaXniSOKE+G4U5GaJoHkzw== X-Received: by 2002:aa7:9a8e:0:b029:2e7:e3fd:4fa4 with SMTP id w14-20020aa79a8e0000b02902e7e3fd4fa4mr923249pfi.63.1622072856793; Wed, 26 May 2021 16:47:36 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 30/31] target/mips: Fold jazz behaviour into mips_cpu_do_transaction_failed Date: Wed, 26 May 2021 16:47:09 -0700 Message-Id: <20210526234710.125396-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Add a flag to MIPSCPUClass in order to avoid needing to replace mips_tcg_ops.do_transaction_failed. Tested-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-ID: <20210227232519.222663-2-richard.henderson@linaro.org> --- target/mips/cpu-qom.h | 3 +++ hw/mips/jazz.c | 35 +++-------------------------------- target/mips/tcg/op_helper.c | 3 ++- 3 files changed, 8 insertions(+), 33 deletions(-) -- 2.25.1 diff --git a/target/mips/cpu-qom.h b/target/mips/cpu-qom.h index 826ab13019..dda0c911fa 100644 --- a/target/mips/cpu-qom.h +++ b/target/mips/cpu-qom.h @@ -47,6 +47,9 @@ struct MIPSCPUClass { DeviceRealize parent_realize; DeviceReset parent_reset; const struct mips_def_t *cpu_def; + + /* Used for the jazz board to modify mips_cpu_do_transaction_failed. */ + bool no_data_aborts; }; diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index dba2088ed1..1e1cf8154e 100644 --- a/hw/mips/jazz.c +++ b/hw/mips/jazz.c @@ -119,30 +119,6 @@ static const MemoryRegionOps dma_dummy_ops = { #define MAGNUM_BIOS_SIZE \ (BIOS_SIZE < MAGNUM_BIOS_SIZE_MAX ? BIOS_SIZE : MAGNUM_BIOS_SIZE_MAX) -#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY) -static void (*real_do_transaction_failed)(CPUState *cpu, hwaddr physaddr, - vaddr addr, unsigned size, - MMUAccessType access_type, - int mmu_idx, MemTxAttrs attrs, - MemTxResult response, - uintptr_t retaddr); - -static void mips_jazz_do_transaction_failed(CPUState *cs, hwaddr physaddr, - vaddr addr, unsigned size, - MMUAccessType access_type, - int mmu_idx, MemTxAttrs attrs, - MemTxResult response, - uintptr_t retaddr) -{ - if (access_type != MMU_INST_FETCH) { - /* ignore invalid access (ie do not raise exception) */ - return; - } - (*real_do_transaction_failed)(cs, physaddr, addr, size, access_type, - mmu_idx, attrs, response, retaddr); -} -#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */ - static void mips_jazz_init(MachineState *machine, enum jazz_model_e jazz_model) { @@ -151,7 +127,7 @@ static void mips_jazz_init(MachineState *machine, int bios_size, n; Clock *cpuclk; MIPSCPU *cpu; - CPUClass *cc; + MIPSCPUClass *mcc; CPUMIPSState *env; qemu_irq *i8259; rc4030_dma *dmas; @@ -198,8 +174,6 @@ static void mips_jazz_init(MachineState *machine, * However, we can't simply add a global memory region to catch * everything, as this would make all accesses including instruction * accesses be ignored and not raise exceptions. - * So instead we hijack the do_transaction_failed method on the CPU, and - * do not raise exceptions for data access. * * NOTE: this behaviour of raising exceptions for bad instruction * fetches but not bad data accesses was added in commit 54e755588cf1e9 @@ -209,11 +183,8 @@ static void mips_jazz_init(MachineState *machine, * we could replace this hijacking of CPU methods with a simple global * memory region that catches all memory accesses, as we do on Malta. */ - cc = CPU_GET_CLASS(cpu); -#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY) - real_do_transaction_failed = cc->tcg_ops->do_transaction_failed; - cc->tcg_ops->do_transaction_failed = mips_jazz_do_transaction_failed; -#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */ + mcc = MIPS_CPU_GET_CLASS(cpu); + mcc->no_data_aborts = true; /* allocate RAM */ memory_region_add_subregion(address_space, 0, machine->ram); diff --git a/target/mips/tcg/op_helper.c b/target/mips/tcg/op_helper.c index ce1549c985..fafbf1faca 100644 --- a/target/mips/tcg/op_helper.c +++ b/target/mips/tcg/op_helper.c @@ -409,11 +409,12 @@ void mips_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, MemTxResult response, uintptr_t retaddr) { MIPSCPU *cpu = MIPS_CPU(cs); + MIPSCPUClass *mcc = MIPS_CPU_GET_CLASS(cpu); CPUMIPSState *env = &cpu->env; if (access_type == MMU_INST_FETCH) { do_raise_exception(env, EXCP_IBE, retaddr); - } else { + } else if (!mcc->no_data_aborts) { do_raise_exception(env, EXCP_DBE, retaddr); } } From patchwork Wed May 26 23:47:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448685 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp24651jac; Wed, 26 May 2021 17:12:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyY+B+1cOiisVcx1UmJblkS3WWdFKykYcwXugTkWM66NO/uDA+Zl6EVCzAgWdTZgUvtw8Bw X-Received: by 2002:a05:6e02:1b06:: with SMTP id i6mr676173ilv.139.1622074321532; Wed, 26 May 2021 17:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622074321; cv=none; d=google.com; s=arc-20160816; b=lt/ieZYbDuNFoJvs1hlC8AInmSjZaHhp0KZEeQntDFIAlcHcfUohsZugRclIoBFxA7 0AM6n1r04HLEtQN2dSJzf1ZSx6vTI0pfiOGEt+6NSuud9nkesHan83x2Pxix6beufgAr kThycz2IeMK8CzPKgd0QEkp1fma3oZu4aQwZmDSWnD9UC1YlvUO8cK2YJzPd97Ti+/Ff YqpGotFnJCLb7OKhHDf6s++pUuMvaID/OPwLqd69TTCEi0yGmwRrbjO852XdEBDUE2SD hAsF2v1QqouIdoPwpQL8Is1pQRAiiNmLgfpHCpLzpq6ufR+49KDs/p4zwWBC5vpS089l mxwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=xIGXFqpV1aqYGlAuOTl1TNlxx1ctCRcyu52r3zRaYUw=; b=K4EczNe/GwPEW43jWYFzVoqzGgy+2OYKsPfCkLqp4snTTnIiPcEf4n6TfVWVXTccOw w68l/PTnk9lvFw4bcDNSB1+1l7WuC0Uv0L2Ql6dwVSzU/5LjaNAu7JuAg6UhPuH3c7+O I9XyTvngr6R05sbbBzn+A/YmuP/XvATQedrxSzHFe1PqJfTmm+O4virrkDcrFLxMU8NZ 9LS5ELIZOuMUU2muPmn7YwGHxGaG5d2/jNmol/nbghnnUyRPmssh69mK7MSCNxhymHiG eRHQskLq1gCues2JanWiMLHca6gdq7s/3yZg8QpR3SEgCHAGQEp3Ki3Q2vXgazyaNhNQ xtpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kTl6T+Sd; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p31si881277jac.95.2021.05.26.17.12.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 17:12:01 -0700 (PDT) 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=kTl6T+Sd; 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 Received: from localhost ([::1]:55588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3d3-0002QG-0I for patch@linaro.org; Wed, 26 May 2021 20:12:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3Fk-00068r-CW for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:56 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:37767) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FU-0004eS-PM for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:54 -0400 Received: by mail-pg1-x52e.google.com with SMTP id t193so2301698pgb.4 for ; Wed, 26 May 2021 16:47:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xIGXFqpV1aqYGlAuOTl1TNlxx1ctCRcyu52r3zRaYUw=; b=kTl6T+SdPJud0qQIGvYX5A7K2ilIWzwyflJ5+4k487aFy2swQXhQcLBG1EqG+F9n6N qbXXragKq9mO3XbCEcNuSSsRqQbrk7oDab8BP3/Mako5CKTZOUGG7mEn62Uvc5cBB80N mCKiI9ibmiQdYy526fRBikjzuMX0V97keqgmP8xc13mzq1Zvjyy1RqcTLA4UTni6MAu9 8q8ASQ2me9jjbtr6eM6T+FO4ELAGbDQrQcfpEqtGsdnG7SDBUAg9ejHPKUYwpI4DluJZ TnLGOcacyxsylGbEEPCAIUDq8HleKki4ZG3gmCRrNjtMuQGjpeIUl8ofNpY9zrV4zt03 82HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xIGXFqpV1aqYGlAuOTl1TNlxx1ctCRcyu52r3zRaYUw=; b=DMuxK4xJUslkbAXEPs/NHpGFc1Ns+XWyE23xtoTq/mWQEczmTd/J1lvgBXkaMg6c1G Kdx7ZqKMlTJ5GIH0RWU5ypanJnvlo346A8KBdBRoQB5j3YJTPUX4YKWwM2iMuMsdp4a5 oSkW7E1xkp4lLZ1pkuPFY6UIg0+8J+ztRVvBWzvP968C6S/vq3F9wKPwUKb4ln1Suqgb FGrgYRyjG9d4ORoEgOOoeB3Di8VasK2IPrxD+Gw6EWkke0aZSczrW52uKky/1aQKdYlZ iSZL2kDzHy3qkwvGqW7gCXMrUgqysuL6MVj9DTwD6RRCutROJSAWQTISCeK4fxmUWpwm Nd4w== X-Gm-Message-State: AOAM530ML2KCqyb6U2MYF/Fa8AyMNSMmtTlJXfLKjuStPMwQ1X8ge8lJ kD0fmbdiUNhI/67ycecJeIy6vsA0aizWbg== X-Received: by 2002:a63:3e8c:: with SMTP id l134mr1017816pga.202.1622072857505; Wed, 26 May 2021 16:47:37 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 31/31] hw/core: Constify TCGCPUOps Date: Wed, 26 May 2021 16:47:10 -0700 Message-Id: <20210526234710.125396-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We no longer have any runtime modifications to this struct, so declare them all const. Tested-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-ID: <20210227232519.222663-3-richard.henderson@linaro.org> --- include/hw/core/cpu.h | 2 +- target/alpha/cpu.c | 2 +- target/arm/cpu.c | 2 +- target/arm/cpu_tcg.c | 2 +- target/avr/cpu.c | 2 +- target/cris/cpu.c | 4 ++-- target/hexagon/cpu.c | 2 +- target/hppa/cpu.c | 2 +- target/i386/tcg/tcg-cpu.c | 2 +- target/m68k/cpu.c | 2 +- target/microblaze/cpu.c | 2 +- target/mips/cpu.c | 2 +- target/nios2/cpu.c | 2 +- target/openrisc/cpu.c | 2 +- target/ppc/cpu_init.c | 2 +- target/riscv/cpu.c | 2 +- target/rx/cpu.c | 2 +- target/s390x/cpu.c | 2 +- target/sh4/cpu.c | 2 +- target/sparc/cpu.c | 2 +- target/tricore/cpu.c | 2 +- target/xtensa/cpu.c | 2 +- 22 files changed, 23 insertions(+), 23 deletions(-) -- 2.25.1 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index e4328de8d4..9f09a60fbd 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -156,7 +156,7 @@ struct CPUClass { const struct SysemuCPUOps *sysemu_ops; /* when TCG is not available, this pointer is NULL */ - struct TCGCPUOps *tcg_ops; + const struct TCGCPUOps *tcg_ops; /* * if not NULL, this is called in order for the CPUClass to initialize diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index 7687d5a09a..4871ad0c0a 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -216,7 +216,7 @@ static const struct SysemuCPUOps alpha_sysemu_ops = { #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps alpha_tcg_ops = { +static const struct TCGCPUOps alpha_tcg_ops = { .initialize = alpha_translate_init, .cpu_exec_interrupt = alpha_cpu_exec_interrupt, .tlb_fill = alpha_cpu_tlb_fill, diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 2d9b32ec92..ad65b60b04 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1958,7 +1958,7 @@ static const struct SysemuCPUOps arm_sysemu_ops = { #endif #ifdef CONFIG_TCG -static struct TCGCPUOps arm_tcg_ops = { +static const struct TCGCPUOps arm_tcg_ops = { .initialize = arm_translate_init, .synchronize_from_tb = arm_cpu_synchronize_from_tb, .cpu_exec_interrupt = arm_cpu_exec_interrupt, diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c index d3458335ed..2e0e508f0e 100644 --- a/target/arm/cpu_tcg.c +++ b/target/arm/cpu_tcg.c @@ -898,7 +898,7 @@ static void pxa270c5_initfn(Object *obj) } #ifdef CONFIG_TCG -static struct TCGCPUOps arm_v7m_tcg_ops = { +static const struct TCGCPUOps arm_v7m_tcg_ops = { .initialize = arm_translate_init, .synchronize_from_tb = arm_cpu_synchronize_from_tb, .cpu_exec_interrupt = arm_v7m_cpu_exec_interrupt, diff --git a/target/avr/cpu.c b/target/avr/cpu.c index 7551bca3a6..57e3fab4a0 100644 --- a/target/avr/cpu.c +++ b/target/avr/cpu.c @@ -192,7 +192,7 @@ static const struct SysemuCPUOps avr_sysemu_ops = { #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps avr_tcg_ops = { +static const struct TCGCPUOps avr_tcg_ops = { .initialize = avr_cpu_tcg_init, .synchronize_from_tb = avr_cpu_synchronize_from_tb, .cpu_exec_interrupt = avr_cpu_exec_interrupt, diff --git a/target/cris/cpu.c b/target/cris/cpu.c index 9cb4f817b4..70932b1f8c 100644 --- a/target/cris/cpu.c +++ b/target/cris/cpu.c @@ -203,7 +203,7 @@ static const struct SysemuCPUOps cris_sysemu_ops = { #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps crisv10_tcg_ops = { +static const struct TCGCPUOps crisv10_tcg_ops = { .initialize = cris_initialize_crisv10_tcg, .cpu_exec_interrupt = cris_cpu_exec_interrupt, .tlb_fill = cris_cpu_tlb_fill, @@ -213,7 +213,7 @@ static struct TCGCPUOps crisv10_tcg_ops = { #endif /* !CONFIG_USER_ONLY */ }; -static struct TCGCPUOps crisv32_tcg_ops = { +static const struct TCGCPUOps crisv32_tcg_ops = { .initialize = cris_initialize_tcg, .cpu_exec_interrupt = cris_cpu_exec_interrupt, .tlb_fill = cris_cpu_tlb_fill, diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index ebe60a6e15..3338365c16 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -269,7 +269,7 @@ static bool hexagon_tlb_fill(CPUState *cs, vaddr address, int size, #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps hexagon_tcg_ops = { +static const struct TCGCPUOps hexagon_tcg_ops = { .initialize = hexagon_translate_init, .synchronize_from_tb = hexagon_cpu_synchronize_from_tb, .tlb_fill = hexagon_tlb_fill, diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 4018e3ad90..2eace4ee12 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -141,7 +141,7 @@ static const struct SysemuCPUOps hppa_sysemu_ops = { #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps hppa_tcg_ops = { +static const struct TCGCPUOps hppa_tcg_ops = { .initialize = hppa_translate_init, .synchronize_from_tb = hppa_cpu_synchronize_from_tb, .cpu_exec_interrupt = hppa_cpu_exec_interrupt, diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c index ba39531aa5..014ebea2f6 100644 --- a/target/i386/tcg/tcg-cpu.c +++ b/target/i386/tcg/tcg-cpu.c @@ -56,7 +56,7 @@ static void x86_cpu_synchronize_from_tb(CPUState *cs, #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps x86_tcg_ops = { +static const struct TCGCPUOps x86_tcg_ops = { .initialize = tcg_x86_init, .synchronize_from_tb = x86_cpu_synchronize_from_tb, .cpu_exec_enter = x86_cpu_exec_enter, diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 4238775d5e..72de6e9726 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -513,7 +513,7 @@ static const struct SysemuCPUOps m68k_sysemu_ops = { #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps m68k_tcg_ops = { +static const struct TCGCPUOps m68k_tcg_ops = { .initialize = m68k_tcg_init, .cpu_exec_interrupt = m68k_cpu_exec_interrupt, .tlb_fill = m68k_cpu_tlb_fill, diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 8f88f2afb9..72d8f2a0da 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -362,7 +362,7 @@ static const struct SysemuCPUOps mb_sysemu_ops = { #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps mb_tcg_ops = { +static const struct TCGCPUOps mb_tcg_ops = { .initialize = mb_tcg_init, .synchronize_from_tb = mb_cpu_synchronize_from_tb, .cpu_exec_interrupt = mb_cpu_exec_interrupt, diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 7275f64eab..96236abc00 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -536,7 +536,7 @@ static const struct SysemuCPUOps mips_sysemu_ops = { * NB: cannot be const, as some elements are changed for specific * mips hardware (see hw/mips/jazz.c). */ -static struct TCGCPUOps mips_tcg_ops = { +static const struct TCGCPUOps mips_tcg_ops = { .initialize = mips_tcg_init, .synchronize_from_tb = mips_cpu_synchronize_from_tb, .cpu_exec_interrupt = mips_cpu_exec_interrupt, diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c index afcd776746..5e37defef8 100644 --- a/target/nios2/cpu.c +++ b/target/nios2/cpu.c @@ -217,7 +217,7 @@ static const struct SysemuCPUOps nios2_sysemu_ops = { #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps nios2_tcg_ops = { +static const struct TCGCPUOps nios2_tcg_ops = { .initialize = nios2_tcg_init, .cpu_exec_interrupt = nios2_cpu_exec_interrupt, .tlb_fill = nios2_cpu_tlb_fill, diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index d8e80b81a2..bd34e429ec 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -184,7 +184,7 @@ static const struct SysemuCPUOps openrisc_sysemu_ops = { #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps openrisc_tcg_ops = { +static const struct TCGCPUOps openrisc_tcg_ops = { .initialize = openrisc_translate_init, .cpu_exec_interrupt = openrisc_cpu_exec_interrupt, .tlb_fill = openrisc_cpu_tlb_fill, diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 1afa29e338..7bdb443114 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -9278,7 +9278,7 @@ static const struct SysemuCPUOps ppc_sysemu_ops = { #ifdef CONFIG_TCG #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps ppc_tcg_ops = { +static const struct TCGCPUOps ppc_tcg_ops = { .initialize = ppc_translate_init, .cpu_exec_interrupt = ppc_cpu_exec_interrupt, .tlb_fill = ppc_cpu_tlb_fill, diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 9775d8ca5c..1f1cef1d6a 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -609,7 +609,7 @@ static const struct SysemuCPUOps riscv_sysemu_ops = { #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps riscv_tcg_ops = { +static const struct TCGCPUOps riscv_tcg_ops = { .initialize = riscv_translate_init, .synchronize_from_tb = riscv_cpu_synchronize_from_tb, .cpu_exec_interrupt = riscv_cpu_exec_interrupt, diff --git a/target/rx/cpu.c b/target/rx/cpu.c index e575669ad1..96cc96e514 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -183,7 +183,7 @@ static const struct SysemuCPUOps rx_sysemu_ops = { #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps rx_tcg_ops = { +static const struct TCGCPUOps rx_tcg_ops = { .initialize = rx_translate_init, .synchronize_from_tb = rx_cpu_synchronize_from_tb, .cpu_exec_interrupt = rx_cpu_exec_interrupt, diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index bd5070c783..890f382a36 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -490,7 +490,7 @@ static const struct SysemuCPUOps s390_sysemu_ops = { #ifdef CONFIG_TCG #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps s390_tcg_ops = { +static const struct TCGCPUOps s390_tcg_ops = { .initialize = s390x_translate_init, .tlb_fill = s390_cpu_tlb_fill, diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 1d5a715631..8326922942 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -233,7 +233,7 @@ static const struct SysemuCPUOps sh4_sysemu_ops = { #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps superh_tcg_ops = { +static const struct TCGCPUOps superh_tcg_ops = { .initialize = sh4_translate_init, .synchronize_from_tb = superh_cpu_synchronize_from_tb, .cpu_exec_interrupt = superh_cpu_exec_interrupt, diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index ff950fb307..da6b30ec74 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -860,7 +860,7 @@ static const struct SysemuCPUOps sparc_sysemu_ops = { #ifdef CONFIG_TCG #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps sparc_tcg_ops = { +static const struct TCGCPUOps sparc_tcg_ops = { .initialize = sparc_tcg_init, .synchronize_from_tb = sparc_cpu_synchronize_from_tb, .cpu_exec_interrupt = sparc_cpu_exec_interrupt, diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index ff17d1cecd..b95682b7f0 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -150,7 +150,7 @@ static const struct SysemuCPUOps tricore_sysemu_ops = { #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps tricore_tcg_ops = { +static const struct TCGCPUOps tricore_tcg_ops = { .initialize = tricore_tcg_init, .synchronize_from_tb = tricore_cpu_synchronize_from_tb, .tlb_fill = tricore_cpu_tlb_fill, diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index da4dbecdf1..58ec3a0862 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -190,7 +190,7 @@ static const struct SysemuCPUOps xtensa_sysemu_ops = { #include "hw/core/tcg-cpu-ops.h" -static struct TCGCPUOps xtensa_tcg_ops = { +static const struct TCGCPUOps xtensa_tcg_ops = { .initialize = xtensa_translate_init, .cpu_exec_interrupt = xtensa_cpu_exec_interrupt, .tlb_fill = xtensa_cpu_tlb_fill,