From patchwork Fri Jul 7 11:31:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 700025 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp3821629wrs; Fri, 7 Jul 2023 04:39:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlH+HOmxYCoNEIzkzaYRcGNjcOnF06RxgTPrqp3M6OnpNKYM7fiNPwCsEyCV1QKs0rbOlhYb X-Received: by 2002:a05:622a:1897:b0:3f6:af5f:29a6 with SMTP id v23-20020a05622a189700b003f6af5f29a6mr6450756qtc.33.1688729953358; Fri, 07 Jul 2023 04:39:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688729953; cv=none; d=google.com; s=arc-20160816; b=TCZbNEJXbGK5SElFZQEJyWX3a2FLvpLZ8gWHH0JeBtblohlnWaI2bfsRzmc67xUjGE RKM0v6YFCIYiCnREBGnD4xHyLdCjOr1/em0TI8aFePnFHmQLoSb+fMzw4WtmZYCJ7zJS nr5ENTJGQXL/+h1nPoC6OmAhboVYoQhPfBpIdmPW7pmqlUlHhUOub/ZI+Q//ywRG+iN5 yQy/TJdP/0+Le7d8g1BJrph20op8D8h0kBxgszIk1RwpDxjpCRi+wRC/+yN9wgt8Vfvd bgYjAo2fYt5QSittrtEd0/R4xyz3J5xB21iKplzIBMeshR6Ru5EvYm4SISGn+PcUQvhB KzCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vyRl/W7ZNZqVgECRppBCmUJyOD4zjvRr0STjlJCdpG0=; fh=52YY/OuLkLNjvSoAPE9Ire0sLQcF4l+B9WKlPNKG8ko=; b=XOK3ER23GRqS5Ebyuy7MuF+r724+wd+Uw44gKJjcSKMa12OVuPZnB7ghI28uwvVPmt CP8y0Q3wRRaxVj73hd4Qwrg5WeSuUTuBFVLvMQM/SWbn5ElRyBw3UFHmVA2lFl+t/VOY ywWi+sTfMNRXfGS2GSV0qzEmVTou8e+AgR6vwIsuOaqE3OoDotUVVR+l9cBzAMa6ycjU KCoaXViQ2WqVQki3AnzxsxwMqbJFW+O3H5wTw7ucnGlwl8nzRbOvMRimI7H18jYtZ7Ho jSw3RhW3cVawMstkQvwQ3tv649tE0jhaG60qWwTOg8HByS5tJXAxvbefvifGG67Sex1Q FFOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ocBbeUdv; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z4-20020ac87f84000000b003f4f522dd90si2384849qtj.457.2023.07.07.04.39.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jul 2023 04:39:13 -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=@gmail.com header.s=20221208 header.b=ocBbeUdv; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qHjiZ-0007DA-Kd; Fri, 07 Jul 2023 07:33:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qHjiX-00078E-K1; Fri, 07 Jul 2023 07:33:41 -0400 Received: from mail-oa1-x2c.google.com ([2001:4860:4864:20::2c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qHjiW-00072a-0P; Fri, 07 Jul 2023 07:33:41 -0400 Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-19fa4346498so1678630fac.1; Fri, 07 Jul 2023 04:33:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688729618; x=1691321618; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vyRl/W7ZNZqVgECRppBCmUJyOD4zjvRr0STjlJCdpG0=; b=ocBbeUdv/ZXn0vgVUDNw0gJ7buGeZIBxp/nOufRXXAtFmJPA1O5LaETQ3uNjjhQZkQ P4l9QIcg7yYu8M0SkDDIoYWzLMbCicNY5Psrzc8pbLwedisRIsPnLPY9DbSVEKJuu1fp ssVQVhVjLAd+xvyjhoJYpDX7MkMFiWyTryv5TTeh8w6DSfd8+MvZplRUAtFHAhiMHc7P uiUpc1Sm4NhcOzB9B7vwt8PJznqXXFHYavGO4nj9ujJESDxEcNS1gZ4WmsQM1gvdevE7 JY81RByiZlQiJ6l0nrecq7AV5upMIxeHC9yByz2HhKsElTWxhLbZinTZk8gUW8SuTI0H 9vYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688729618; x=1691321618; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vyRl/W7ZNZqVgECRppBCmUJyOD4zjvRr0STjlJCdpG0=; b=bboWGCWXLW6jPWtf3na+tS40LkGZ5vRpxduomAzgFH3eW1XAnsiIEJCB0gxb67P7qt mDInDXZyHaxYwb7m53PUMpsLLuoWQQH1HcHMdbvrAg+++GRGarS54oBpqgiq7gnI6bAC 5H/0l7E8CX8VwlT008sfpy2VvzimawRtXyLsD1BPagfBZAepERnRLMcTBOcobgDSqkR+ lHSNiy7IK6tfVbQMh7fT9k4TzG8ndy+86PkeRZtc4LPmDFBDXdQQj8S637kW/zpAT7O0 i7f4EHwhEbZw+aSvy0poIXbM2gtBNFgJCm2lejByZcYCZpdRJucbElYlraZT2AjWc56T th/g== X-Gm-Message-State: ABy/qLZRsYXG0q0iyOtKZDTsNoAdByY4MKx2tzZjbPYS5ocbm42orgtj t62Z/MKX5aQQrPo+nUtVOAT+Cvnn2qs= X-Received: by 2002:a05:6870:fba7:b0:1b0:3075:2f9d with SMTP id kv39-20020a056870fba700b001b030752f9dmr5400269oab.34.1688729618282; Fri, 07 Jul 2023 04:33:38 -0700 (PDT) Received: from grind.. ([2804:14c:f435:9162::1002]) by smtp.gmail.com with ESMTPSA id g17-20020a9d6c51000000b006b74b37f5e5sm1574859otq.20.2023.07.07.04.33.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jul 2023 04:33:38 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, richard.henderson@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= Subject: [PULL 54/60] target/ppc: Reorder #ifdef'ry in kvm_ppc.h Date: Fri, 7 Jul 2023 08:31:02 -0300 Message-ID: <20230707113108.7145-55-danielhb413@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230707113108.7145-1-danielhb413@gmail.com> References: <20230707113108.7145-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2c; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x2c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Keep a single if/else/endif block checking CONFIG_KVM. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Message-ID: <20230627115124.19632-3-philmd@linaro.org> Signed-off-by: Daniel Henrique Barboza --- target/ppc/kvm_ppc.h | 62 ++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h index 2e395416f0..49954a300b 100644 --- a/target/ppc/kvm_ppc.h +++ b/target/ppc/kvm_ppc.h @@ -93,7 +93,34 @@ void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset); int kvm_handle_nmi(PowerPCCPU *cpu, struct kvm_run *run); -#else +#define kvmppc_eieio() \ + do { \ + if (kvm_enabled()) { \ + asm volatile("eieio" : : : "memory"); \ + } \ + } while (0) + +/* Store data cache blocks back to memory */ +static inline void kvmppc_dcbst_range(PowerPCCPU *cpu, uint8_t *addr, int len) +{ + uint8_t *p; + + for (p = addr; p < addr + len; p += cpu->env.dcache_line_size) { + asm volatile("dcbst 0,%0" : : "r"(p) : "memory"); + } +} + +/* Invalidate instruction cache blocks */ +static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len) +{ + uint8_t *p; + + for (p = addr; p < addr + len; p += cpu->env.icache_line_size) { + asm volatile("icbi 0,%0" : : "r"(p)); + } +} + +#else /* !CONFIG_KVM */ static inline uint32_t kvmppc_get_tbfreq(void) { @@ -440,10 +467,6 @@ static inline bool kvmppc_pvr_workaround_required(PowerPCCPU *cpu) return false; } -#endif - -#ifndef CONFIG_KVM - #define kvmppc_eieio() do { } while (0) static inline void kvmppc_dcbst_range(PowerPCCPU *cpu, uint8_t *addr, int len) @@ -454,35 +477,6 @@ static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len) { } -#else /* CONFIG_KVM */ - -#define kvmppc_eieio() \ - do { \ - if (kvm_enabled()) { \ - asm volatile("eieio" : : : "memory"); \ - } \ - } while (0) - -/* Store data cache blocks back to memory */ -static inline void kvmppc_dcbst_range(PowerPCCPU *cpu, uint8_t *addr, int len) -{ - uint8_t *p; - - for (p = addr; p < addr + len; p += cpu->env.dcache_line_size) { - asm volatile("dcbst 0,%0" : : "r"(p) : "memory"); - } -} - -/* Invalidate instruction cache blocks */ -static inline void kvmppc_icbi_range(PowerPCCPU *cpu, uint8_t *addr, int len) -{ - uint8_t *p; - - for (p = addr; p < addr + len; p += cpu->env.icache_line_size) { - asm volatile("icbi 0,%0" : : "r"(p)); - } -} - #endif /* CONFIG_KVM */ #endif /* KVM_PPC_H */