From patchwork Mon Jul 18 17:21:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657591 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Nt2KWXK4; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lmpms06L9z9sFs for ; Tue, 19 Jul 2022 03:27:07 +1000 (AEST) Received: from localhost ([::1]:60854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUWP-0002J4-Dy for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:27:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43048) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDURp-0007Lj-AR; Mon, 18 Jul 2022 13:22:21 -0400 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]:40571) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDURn-0001fK-LH; Mon, 18 Jul 2022 13:22:21 -0400 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-10c0e6dd55eso25477550fac.7; Mon, 18 Jul 2022 10:22:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yotMDKnrlvzuD84KZXN8hdzQeDs7OAIA1C+lLZ2UREw=; b=Nt2KWXK48bgWMKgKfRbv+d91EMjI1nIfav1Q1krSzupNb03EyfK8PcyfSV4zWyMrOR EwZhja0kwKmFTjuQ4o8SbD6rA7GBM/ACXzGW3CZYn/yFQuRfVcGbrbOk/dXY8Zax8U1y o7wY6BZt3BsJat6a6Ez7l6Xuf1k/tg4gxMn13v/JIvP1n30ammSoz9h+ZrFNniy0g2LN wQWdLsVuNJuRkQK2XlE72PTKRA2cWz+Zbd8FP8hg4yl/dOzywEtA3qu0Ec1wU6172WNC sw0MkHf1UEZDfv52GWsu0Z29Ng++sREHU8Z+a8buc43cs/mbKHvGybWUFoWkoLLL8mb9 deEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yotMDKnrlvzuD84KZXN8hdzQeDs7OAIA1C+lLZ2UREw=; b=4I528g57W/0S12SYtlopOsF+fd6ecJUHBBOIOMFLYWwSAomWIg5eNAk//dV6O8hAgE tJjVsnbDFQNs5DFiluj/GydOuBtaX3t/3dYT5A6mZTD3MUgM7EJscq3NT0NToicgZTd6 TKxdE5h99vK66IPUiK1yXqc4xNtLZgb8eCDR1u94fRA6488agZ9yFZORoEZvUbV5gblC +y/5uVhG4tw5T23zXxh/6Uz3Z7sCvC5vyCGJisbs3U3LMNt0wIRKGs7kjke0FSwR3VwK DTvCigW0ZctU7M0jydgseVzPtJoTtRaj+nyzokybHOHtDIV7cgws3o0pFw3bC6Gkcv/Q Tj+Q== X-Gm-Message-State: AJIora+ARof+rnk+4qPPRmEk/Beekuj/rfFFTzjqFAH9yMJPB1ZI38I0 ZsL+zWXq8VLpHgCRXZoHrSg6HW6EDGc= X-Google-Smtp-Source: AGRyM1uLCMkcrPID8QdniCfmNYWLnHWPa2zREtRDBNLrOgICbTzrVu0Y4aCjHJavq50DuvY6/DoRAQ== X-Received: by 2002:a05:6870:8186:b0:10c:2ed:44f9 with SMTP id k6-20020a056870818600b0010c02ed44f9mr18088868oae.35.1658164936924; Mon, 18 Jul 2022 10:22:16 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:16 -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?C=C3=A9dric_Le_Goater?= , Mark Cave-Ayland Subject: [PULL 01/30] ppc64: Allocate IRQ lines with qdev_init_gpio_in() Date: Mon, 18 Jul 2022 14:21:39 -0300 Message-Id: <20220718172208.1247624-2-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2e; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x2e.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Cédric Le Goater This replaces the IRQ array 'irq_inputs' with GPIO lines, the goal being to remove 'irq_inputs' when all CPUs have been converted. Signed-off-by: Cédric Le Goater Acked-by: Mark Cave-Ayland Reviewed-by: Peter Maydell Message-Id: <20220705145814.461723-2-clg@kaod.org> Signed-off-by: Daniel Henrique Barboza --- hw/intc/xics.c | 10 ++++++---- hw/intc/xive.c | 4 ++-- hw/ppc/mac_newworld.c | 8 ++++---- hw/ppc/ppc.c | 15 +++------------ 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 24e67020db..5b0b4d9624 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -301,23 +301,25 @@ void icp_reset(ICPState *icp) static void icp_realize(DeviceState *dev, Error **errp) { ICPState *icp = ICP(dev); + PowerPCCPU *cpu; CPUPPCState *env; Error *err = NULL; assert(icp->xics); assert(icp->cs); - env = &POWERPC_CPU(icp->cs)->env; + cpu = POWERPC_CPU(icp->cs); + env = &cpu->env; switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_POWER7: - icp->output = env->irq_inputs[POWER7_INPUT_INT]; + icp->output = qdev_get_gpio_in(DEVICE(cpu), POWER7_INPUT_INT); break; case PPC_FLAGS_INPUT_POWER9: /* For SPAPR xics emulation */ - icp->output = env->irq_inputs[POWER9_INPUT_INT]; + icp->output = qdev_get_gpio_in(DEVICE(cpu), POWER9_INPUT_INT); break; case PPC_FLAGS_INPUT_970: - icp->output = env->irq_inputs[PPC970_INPUT_INT]; + icp->output = qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_INT); break; default: diff --git a/hw/intc/xive.c b/hw/intc/xive.c index ae221fed73..a986b96843 100644 --- a/hw/intc/xive.c +++ b/hw/intc/xive.c @@ -695,8 +695,8 @@ static void xive_tctx_realize(DeviceState *dev, Error **errp) env = &cpu->env; switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_POWER9: - tctx->hv_output = env->irq_inputs[POWER9_INPUT_HINT]; - tctx->os_output = env->irq_inputs[POWER9_INPUT_INT]; + tctx->hv_output = qdev_get_gpio_in(DEVICE(cpu), POWER9_INPUT_HINT); + tctx->os_output = qdev_get_gpio_in(DEVICE(cpu), POWER9_INPUT_INT); break; default: diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index c865921bdc..22405dd27a 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -276,16 +276,16 @@ static void ppc_core99_init(MachineState *machine) #if defined(TARGET_PPC64) case PPC_FLAGS_INPUT_970: openpic_irqs[i].irq[OPENPIC_OUTPUT_INT] = - ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; + qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_INT); openpic_irqs[i].irq[OPENPIC_OUTPUT_CINT] = - ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; + qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_INT); openpic_irqs[i].irq[OPENPIC_OUTPUT_MCK] = - ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_MCP]; + qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_MCP); /* Not connected ? */ openpic_irqs[i].irq[OPENPIC_OUTPUT_DEBUG] = NULL; /* Check this */ openpic_irqs[i].irq[OPENPIC_OUTPUT_RESET] = - ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_HRESET]; + qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_HRESET); break; #endif /* defined(TARGET_PPC64) */ default: diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index fea70df45e..15f2b5f0f0 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -234,10 +234,7 @@ static void ppc970_set_irq(void *opaque, int pin, int level) void ppc970_irq_init(PowerPCCPU *cpu) { - CPUPPCState *env = &cpu->env; - - env->irq_inputs = (void **)qemu_allocate_irqs(&ppc970_set_irq, cpu, - PPC970_INPUT_NB); + qdev_init_gpio_in(DEVICE(cpu), ppc970_set_irq, PPC970_INPUT_NB); } /* POWER7 internal IRQ controller */ @@ -260,10 +257,7 @@ static void power7_set_irq(void *opaque, int pin, int level) void ppcPOWER7_irq_init(PowerPCCPU *cpu) { - CPUPPCState *env = &cpu->env; - - env->irq_inputs = (void **)qemu_allocate_irqs(&power7_set_irq, cpu, - POWER7_INPUT_NB); + qdev_init_gpio_in(DEVICE(cpu), power7_set_irq, POWER7_INPUT_NB); } /* POWER9 internal IRQ controller */ @@ -292,10 +286,7 @@ static void power9_set_irq(void *opaque, int pin, int level) void ppcPOWER9_irq_init(PowerPCCPU *cpu) { - CPUPPCState *env = &cpu->env; - - env->irq_inputs = (void **)qemu_allocate_irqs(&power9_set_irq, cpu, - POWER9_INPUT_NB); + qdev_init_gpio_in(DEVICE(cpu), power9_set_irq, POWER9_INPUT_NB); } #endif /* defined(TARGET_PPC64) */ From patchwork Mon Jul 18 17:21:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657599 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Krf+NSku; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LmpqL38Txz9sFr for ; Tue, 19 Jul 2022 03:29:18 +1000 (AEST) Received: from localhost ([::1]:37988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUYW-00067j-4Z for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:29:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDURq-0007OY-FQ; Mon, 18 Jul 2022 13:22:22 -0400 Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]:40567) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDURo-0001fh-Nn; Mon, 18 Jul 2022 13:22:22 -0400 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-10c0e6dd55eso25477835fac.7; Mon, 18 Jul 2022 10:22:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mKoBtuOTfSB6xcNZ7+vc42tDBIpMtXBiNUw1ZaoB1g0=; b=Krf+NSku9cxFaADIt+Yl2Vv/G3WdKMS8w43uEOdZc7h+grdrDcGA79Pq5bHcr7l3oL Cqjqfx0k5zMBoLLwZH0pyQvhwGgFGaCHMSNQQK4uNbtoXqvyQMMLD6r8WDLzXnO7++nq IkZeuPCMKS5GLWaIRCsIKOyg2m2yBm+I+bHtGvqr0wNN2MD+UaPtomqYkvDyA6aKJY7O 71lMdLxCSAVen3yozMyWjOGpQL5ir+HL2WHm2RuEPZ8gq4bvOqEf51NVGVkUxkNlI5tM 2mc9cmt5Biz4BRX8GJRm3Pbd5ahMoML3gNERv+8rH7Hsz6RzMYabf8Jjd3AlrtP3Sdn6 NRQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mKoBtuOTfSB6xcNZ7+vc42tDBIpMtXBiNUw1ZaoB1g0=; b=IrcnMRZQbc4UBYhKlRc3WjMrydd78PnT7bf+EJiC4R6HYGMacc6JxzXSnvDhHlCtIQ 0hy+xRBkdhQ4i94XKyk9CDcr2EFNNHR++ixq82i+2SiWFGry8+nVCHm9EJAdaxZCPUz9 4+cbS2+l9H9vC9Colt7UEKUR/mknU8jthYqU/gaLT3vD5K4+CivjQEcfvFVOBPWdN936 VdTI8hTKKDnZi6qzFYdllhIpiT2EupF0z/Pu4RL3SGCB9y08wby6qJ/4uQzRNeKRL1/m Ad8xy7is+HyFFcc697c1yabQD5Z5hJlBCRPlpfvsbQBHzGKjj0i5RAIHXXwPoDNAC7KD 4ASw== X-Gm-Message-State: AJIora+p0EsGdTmBuRRelV1G1DQXbi+J7OMaIxvJ0iNL4P+Zyb9pmPFZ jWbDdauovwfwKsoAsNcVcX/gZtCM79w= X-Google-Smtp-Source: AGRyM1ui+HAQvcW0zo3ppwToBCmbW7SNUmPtFwxLFWefCTDZI9+ZE2E4Y0myZ+cKSJ9mRQInZ1Wnxg== X-Received: by 2002:aca:1003:0:b0:33a:84ce:f366 with SMTP id 3-20020aca1003000000b0033a84cef366mr1412192oiq.117.1658164939167; Mon, 18 Jul 2022 10:22:19 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:18 -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?C=C3=A9dric_Le_Goater?= Subject: [PULL 02/30] ppc/40x: Allocate IRQ lines with qdev_init_gpio_in() Date: Mon, 18 Jul 2022 14:21:40 -0300 Message-Id: <20220718172208.1247624-3-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::29; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x29.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Cédric Le Goater Signed-off-by: Cédric Le Goater Reviewed-by: Peter Maydell Message-Id: <20220705145814.461723-3-clg@kaod.org> Signed-off-by: Daniel Henrique Barboza --- hw/ppc/ppc.c | 5 +---- hw/ppc/ppc405_uc.c | 4 ++-- hw/ppc/ppc440_bamboo.c | 4 ++-- hw/ppc/sam460ex.c | 4 ++-- hw/ppc/virtex_ml507.c | 10 +++++----- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index 15f2b5f0f0..8c88d3a480 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -422,10 +422,7 @@ static void ppc40x_set_irq(void *opaque, int pin, int level) void ppc40x_irq_init(PowerPCCPU *cpu) { - CPUPPCState *env = &cpu->env; - - env->irq_inputs = (void **)qemu_allocate_irqs(&ppc40x_set_irq, - cpu, PPC40x_INPUT_NB); + qdev_init_gpio_in(DEVICE(cpu), ppc40x_set_irq, PPC40x_INPUT_NB); } /* PowerPC E500 internal IRQ controller */ diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c index 36c8ba6f3c..d6420c88d3 100644 --- a/hw/ppc/ppc405_uc.c +++ b/hw/ppc/ppc405_uc.c @@ -1470,9 +1470,9 @@ PowerPCCPU *ppc405ep_init(MemoryRegion *address_space_mem, sysbus_realize_and_unref(uicsbd, &error_fatal); sysbus_connect_irq(uicsbd, PPCUIC_OUTPUT_INT, - ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_INT]); + qdev_get_gpio_in(DEVICE(cpu), PPC40x_INPUT_INT)); sysbus_connect_irq(uicsbd, PPCUIC_OUTPUT_CINT, - ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_CINT]); + qdev_get_gpio_in(DEVICE(cpu), PPC40x_INPUT_CINT)); *uicdevp = uicdev; diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c index d5973f2484..873f930c77 100644 --- a/hw/ppc/ppc440_bamboo.c +++ b/hw/ppc/ppc440_bamboo.c @@ -200,9 +200,9 @@ static void bamboo_init(MachineState *machine) sysbus_realize_and_unref(uicsbd, &error_fatal); sysbus_connect_irq(uicsbd, PPCUIC_OUTPUT_INT, - ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_INT]); + qdev_get_gpio_in(DEVICE(cpu), PPC40x_INPUT_INT)); sysbus_connect_irq(uicsbd, PPCUIC_OUTPUT_CINT, - ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_CINT]); + qdev_get_gpio_in(DEVICE(cpu), PPC40x_INPUT_CINT)); /* SDRAM controller */ memset(ram_bases, 0, sizeof(ram_bases)); diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 2f24598f55..7e8da657c2 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -334,9 +334,9 @@ static void sam460ex_init(MachineState *machine) if (i == 0) { sysbus_connect_irq(sbd, PPCUIC_OUTPUT_INT, - ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_INT]); + qdev_get_gpio_in(DEVICE(cpu), PPC40x_INPUT_INT)); sysbus_connect_irq(sbd, PPCUIC_OUTPUT_CINT, - ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_CINT]); + qdev_get_gpio_in(DEVICE(cpu), PPC40x_INPUT_CINT)); } else { sysbus_connect_irq(sbd, PPCUIC_OUTPUT_INT, qdev_get_gpio_in(uic[0], input_ints[i])); diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index b67a709ddc..53b126ff48 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -111,9 +111,9 @@ static PowerPCCPU *ppc440_init_xilinx(const char *cpu_type, uint32_t sysclk) sysbus_realize_and_unref(uicsbd, &error_fatal); sysbus_connect_irq(uicsbd, PPCUIC_OUTPUT_INT, - ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_INT]); + qdev_get_gpio_in(DEVICE(cpu), PPC40x_INPUT_INT)); sysbus_connect_irq(uicsbd, PPCUIC_OUTPUT_CINT, - ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_CINT]); + qdev_get_gpio_in(DEVICE(cpu), PPC40x_INPUT_CINT)); /* This board doesn't wire anything up to the inputs of the UIC. */ return cpu; @@ -213,7 +213,7 @@ static void virtex_init(MachineState *machine) CPUPPCState *env; hwaddr ram_base = 0; DriveInfo *dinfo; - qemu_irq irq[32], *cpu_irq; + qemu_irq irq[32], cpu_irq; int kernel_size; int i; @@ -236,12 +236,12 @@ static void virtex_init(MachineState *machine) dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, 64 * KiB, 1, 0x89, 0x18, 0x0000, 0x0, 1); - cpu_irq = (qemu_irq *) &env->irq_inputs[PPC40x_INPUT_INT]; + cpu_irq = qdev_get_gpio_in(DEVICE(cpu), PPC40x_INPUT_INT); dev = qdev_new("xlnx.xps-intc"); qdev_prop_set_uint32(dev, "kind-of-intr", 0); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, INTC_BASEADDR); - sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irq[0]); + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irq); for (i = 0; i < 32; i++) { irq[i] = qdev_get_gpio_in(dev, i); } From patchwork Mon Jul 18 17:21:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657601 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=fXEs2nd9; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lmpr52cnYz9sFr for ; Tue, 19 Jul 2022 03:29:57 +1000 (AEST) Received: from localhost ([::1]:41270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUZ9-0008KW-7f for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:29:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDURw-0007UK-Iu; Mon, 18 Jul 2022 13:22:28 -0400 Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]:36831) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDURq-0001eo-NB; Mon, 18 Jul 2022 13:22:24 -0400 Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-10bf634bc50so25528572fac.3; Mon, 18 Jul 2022 10:22:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lJ3G/7AALhm/eJFFx1uv9eE9kShhjgEUUPSmrmJnznw=; b=fXEs2nd9jAPYZEPnHGJMHV4hd5P98UHMClBqsy28KAlG4zAhIjrrIXte6jz3agBcF7 LpmVgbkT9OSq6LJHS0ZCMhyPCyILMWfsmR2Qps3UKy14xaCgluFaM2t4NQBaFvAXr3lV 1H6jn/swrGPl6OcsodUaAAyI4e3yr+5NUX41wGNpzwt3f/RC//k2XHbTLF6aQ/71QSci Alc8jpoEPidJg7ifPHk/A6yYyVqqxszVcUy1+lu9nX87u0D0lFNrPRpQi4WXciqqn/Nx HBXH67bQzBoj6ta2/pYjfVW4nfvGC40cdlM7pbDhPAj576UMKv2QTYzohwM0Gb63uUZO oVLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lJ3G/7AALhm/eJFFx1uv9eE9kShhjgEUUPSmrmJnznw=; b=Ldm+rm9o4Mhc51H+17RGvAu9XJtC+DbJr+SnJ11hU5+yjw7BDEr7Ztvi8RWg0v4nE6 Jg8ytTemGJHCUPp37a93fRz2M1EQTuI2ASBiED8/RIZ+E6hVrO6rrO2z0vZPh6wR4PDK tp4UR+uydpiWTuRsAlGJcULXhDNW5TYBycsruaRk+zoJVKBTvv180Bdjkw4cp10SNC2a XkHsr8lQt7H/chiixunqRUizyOk3AwNzH12TkXgOnrvCx1oD4g0W9TzJkdhTyRenJ1Cy dco1PA7/2Us/XRCT4TA05v+sGVBxfbQQLZ6yYUs0NcN3V9bApVm9To1PNkiYWimhuaPY SRUg== X-Gm-Message-State: AJIora+UjAgN9yDExD9RNrrO2hiL5XH7hKjCAzyPgfwamdg7NK7yjgpI A8hCwE3/iONzFfDRDvooxaWZGTZa440= X-Google-Smtp-Source: AGRyM1vSZiH8nMJg4nz1lEGx65prrMS5iWrJsdylsJt+ECugwEZCm0sqX9NtUJCduuP2sxAw46a/Wg== X-Received: by 2002:a05:6808:6:b0:33a:7265:bace with SMTP id u6-20020a056808000600b0033a7265bacemr3344859oic.270.1658164941515; Mon, 18 Jul 2022 10:22:21 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:21 -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?C=C3=A9dric_Le_Goater?= , Mark Cave-Ayland Subject: [PULL 03/30] ppc/6xx: Allocate IRQ lines with qdev_init_gpio_in() Date: Mon, 18 Jul 2022 14:21:41 -0300 Message-Id: <20220718172208.1247624-4-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::33; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x33.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Cédric Le Goater Signed-off-by: Cédric Le Goater Acked-by: Mark Cave-Ayland Reviewed-by: Peter Maydell Message-Id: <20220705145814.461723-4-clg@kaod.org> Signed-off-by: Daniel Henrique Barboza --- hw/ppc/mac_newworld.c | 8 ++++---- hw/ppc/mac_oldworld.c | 2 +- hw/ppc/pegasos2.c | 2 +- hw/ppc/ppc.c | 5 +---- hw/ppc/prep.c | 2 +- hw/ppc/prep_systemio.c | 2 +- 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 22405dd27a..cf7eb72391 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -262,16 +262,16 @@ static void ppc_core99_init(MachineState *machine) switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_6xx: openpic_irqs[i].irq[OPENPIC_OUTPUT_INT] = - ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; + qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_INT); openpic_irqs[i].irq[OPENPIC_OUTPUT_CINT] = - ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; + qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_INT); openpic_irqs[i].irq[OPENPIC_OUTPUT_MCK] = - ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_MCP]; + qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_MCP); /* Not connected ? */ openpic_irqs[i].irq[OPENPIC_OUTPUT_DEBUG] = NULL; /* Check this */ openpic_irqs[i].irq[OPENPIC_OUTPUT_RESET] = - ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_HRESET]; + qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_HRESET); break; #if defined(TARGET_PPC64) case PPC_FLAGS_INPUT_970: diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index d62fdf0db3..03732ca7ed 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -271,7 +271,7 @@ static void ppc_heathrow_init(MachineState *machine) case PPC_FLAGS_INPUT_6xx: /* XXX: we register only 1 output pin for heathrow PIC */ qdev_connect_gpio_out(pic_dev, 0, - ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]); + qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_INT)); break; default: error_report("Bus model not supported on OldWorld Mac machine"); diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index 9411ca6b16..61f4263953 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -155,7 +155,7 @@ static void pegasos2_init(MachineState *machine) /* Marvell Discovery II system controller */ pm->mv = DEVICE(sysbus_create_simple(TYPE_MV64361, -1, - ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT])); + qdev_get_gpio_in(DEVICE(pm->cpu), PPC6xx_INPUT_INT))); pci_bus = mv64361_get_pci_bus(pm->mv, 1); /* VIA VT8231 South Bridge (multifunction PCI device) */ diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index 8c88d3a480..161e5f9087 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -154,10 +154,7 @@ static void ppc6xx_set_irq(void *opaque, int pin, int level) void ppc6xx_irq_init(PowerPCCPU *cpu) { - CPUPPCState *env = &cpu->env; - - env->irq_inputs = (void **)qemu_allocate_irqs(&ppc6xx_set_irq, cpu, - PPC6xx_INPUT_NB); + qdev_init_gpio_in(DEVICE(cpu), ppc6xx_set_irq, PPC6xx_INPUT_NB); } #if defined(TARGET_PPC64) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index a1cd4505cc..f08714f2ec 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -275,7 +275,7 @@ static void ibm_40p_init(MachineState *machine) /* PCI -> ISA bridge */ i82378_dev = DEVICE(pci_create_simple(pci_bus, PCI_DEVFN(11, 0), "i82378")); qdev_connect_gpio_out(i82378_dev, 0, - cpu->env.irq_inputs[PPC6xx_INPUT_INT]); + qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_INT)); sysbus_connect_irq(pcihost, 0, qdev_get_gpio_in(i82378_dev, 15)); isa_bus = ISA_BUS(qdev_get_child_bus(i82378_dev, "isa.0")); diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c index 8c9b8dd67b..5a56f155f5 100644 --- a/hw/ppc/prep_systemio.c +++ b/hw/ppc/prep_systemio.c @@ -262,7 +262,7 @@ static void prep_systemio_realize(DeviceState *dev, Error **errp) qemu_set_irq(s->non_contiguous_io_map_irq, s->iomap_type & PORT0850_IOMAP_NONCONTIGUOUS); cpu = POWERPC_CPU(first_cpu); - s->softreset_irq = cpu->env.irq_inputs[PPC6xx_INPUT_HRESET]; + s->softreset_irq = qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_HRESET); isa_register_portio_list(isa, &s->portio, 0x0, ppc_io800_port_list, s, "systemio800"); From patchwork Mon Jul 18 17:21:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657606 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=qT1JUaiV; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lmpvl0JGZz9sFr for ; Tue, 19 Jul 2022 03:33:07 +1000 (AEST) Received: from localhost ([::1]:47432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUcC-0004AK-Sd for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:33:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDURz-0007Xs-4d; Mon, 18 Jul 2022 13:22:31 -0400 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]:37789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDURw-0001iF-I6; Mon, 18 Jul 2022 13:22:30 -0400 Received: by mail-ot1-x331.google.com with SMTP id l9-20020a056830268900b006054381dd35so9714244otu.4; Mon, 18 Jul 2022 10:22:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3EAdGvPl897Fy2GKSuCuXls7u3a5WgaSifOKaz/yNew=; b=qT1JUaiVndwPOma+yV5EubNuuzIyR65CsdOrCYe84g+cbkuKWxyLqjbXuqKcfRJtTv C/gDzrZJYHszPqK/Kv6wu0Sc9vTevmQjr1XevrMpWlTO26iws1i72tAeo99IvSx36Y9s hXkXhVm92cVfX0zSQQG9LCi86xOdRPo+DsvBAQFwwJX/WMP8wGQuUrdRCo/QqdDrxA6y jrSQV6vLXUOwdEbk0MH7GSvA89X+BFG5w+kej07jJca1fvELeBeUdlkAY4E0NL1TS371 7xICF/58/1adx2X1PfaLVUmEsmnxdv2JTjynBZCbUFoUzTB0ONcU8Y3Wfh1iAUXjJnns c21Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3EAdGvPl897Fy2GKSuCuXls7u3a5WgaSifOKaz/yNew=; b=8CZtTQWf5vkQH8DHVhujncJMjKR3BPesZWOy1nEUkKf06g2m0nmhRhqS35/nKOvA+f 4l2dYoJEPveHTpl5jEPDeLy0wok4vQZEnjTGHxvcRTxfKhwrn9TJtzZanzBk6hY/hQR0 1qB178xci0ADu1DsEEwMfyxVvhvYexrEkUxd3Z5SWxflIS5ED+Ps2n7qkUatH1yai8Zp IptU+ndHRTKM7x+3DHcoGul/0BRzItKKpVB6sgpdOExqPA7klp8zsrgnQyaJR3e9Pk1/ 9qpFq2E9miINdkf11lXf6HXzqioB7/zFydhljZaBYV/JeI8KyrbQAy5p2BUtcYNugsxd W+pA== X-Gm-Message-State: AJIora8uoj0Pd9WmSIxFayZJjMHyWihv0n5qlHBzz2xLGK1h+KsYEGYE WtzOyZc2sjSoTQqvnmmFqQG6nnTWmic= X-Google-Smtp-Source: AGRyM1uNAHbfe0F6Bh/w1HtMxMs/gpZMF5XSWGg3W8GMShmwqx6xUFxYyKJsytf9wZamj1BQlYQIMQ== X-Received: by 2002:a05:6830:268c:b0:618:5cc0:417d with SMTP id l12-20020a056830268c00b006185cc0417dmr11482754otu.196.1658164943728; Mon, 18 Jul 2022 10:22:23 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:23 -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?C=C3=A9dric_Le_Goater?= Subject: [PULL 04/30] ppc/e500: Allocate IRQ lines with qdev_init_gpio_in() Date: Mon, 18 Jul 2022 14:21:42 -0300 Message-Id: <20220718172208.1247624-5-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::331; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x331.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Cédric Le Goater Signed-off-by: Cédric Le Goater Reviewed-by: Peter Maydell Message-Id: <20220705145814.461723-5-clg@kaod.org> Signed-off-by: Daniel Henrique Barboza --- hw/ppc/e500.c | 8 ++++---- hw/ppc/ppc.c | 5 +---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index 7f7f5b3452..757cfaa62f 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -861,7 +861,6 @@ void ppce500_init(MachineState *machine) for (i = 0; i < smp_cpus; i++) { PowerPCCPU *cpu; CPUState *cs; - qemu_irq *input; cpu = POWERPC_CPU(object_new(machine->cpu_type)); env = &cpu->env; @@ -885,9 +884,10 @@ void ppce500_init(MachineState *machine) firstenv = env; } - input = (qemu_irq *)env->irq_inputs; - irqs[i].irq[OPENPIC_OUTPUT_INT] = input[PPCE500_INPUT_INT]; - irqs[i].irq[OPENPIC_OUTPUT_CINT] = input[PPCE500_INPUT_CINT]; + irqs[i].irq[OPENPIC_OUTPUT_INT] = + qdev_get_gpio_in(DEVICE(cpu), PPCE500_INPUT_INT); + irqs[i].irq[OPENPIC_OUTPUT_CINT] = + qdev_get_gpio_in(DEVICE(cpu), PPCE500_INPUT_CINT); env->spr_cb[SPR_BOOKE_PIR].default_value = cs->cpu_index = i; env->mpic_iack = pmc->ccsrbar_base + MPC8544_MPIC_REGS_OFFSET + 0xa0; diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index 161e5f9087..690f448cb9 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -474,10 +474,7 @@ static void ppce500_set_irq(void *opaque, int pin, int level) void ppce500_irq_init(PowerPCCPU *cpu) { - CPUPPCState *env = &cpu->env; - - env->irq_inputs = (void **)qemu_allocate_irqs(&ppce500_set_irq, - cpu, PPCE500_INPUT_NB); + qdev_init_gpio_in(DEVICE(cpu), ppce500_set_irq, PPCE500_INPUT_NB); } /* Enable or Disable the E500 EPR capability */ From patchwork Mon Jul 18 17:21:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657611 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=KoXakQM2; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LmpzW1hNWz9sFr for ; Tue, 19 Jul 2022 03:36:23 +1000 (AEST) Received: from localhost ([::1]:55810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUfN-0001YD-2D for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:36:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDURz-0007Y8-AG; Mon, 18 Jul 2022 13:22:31 -0400 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]:40880) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDURw-0001jX-KQ; Mon, 18 Jul 2022 13:22:30 -0400 Received: by mail-ot1-x32e.google.com with SMTP id z12-20020a056830128c00b0061c8168d3faso7941659otp.7; Mon, 18 Jul 2022 10:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D+zE054l+MqhuQhW7ZhFxFOtodBT53aNohUvmHGyfeo=; b=KoXakQM2AEwpOqk2tDjJ4kqO3X2cNlsWnvsSTOMQWcgNDCtgERzEdW2fnF7GLzVnFr I3rwhGQMNUJeL+N3Pr8XwTl0Qvl2sfoi2grnYboM3kufOgG/tbBbP+9/zdnj5Z4+MDPz Ktdsmo7m6OtQSPy+gj+QctzEYi4yG8NIbnpWssvbwO67MRdXh2ui7bTarCJSAHECPb/H Muqsc1buo9SnWdg3bpkP2CxfYt7nbFb0BEEMeAXSVzsLi9nzRtXhWUt4rUUSZ+jDIKN5 NeHDGB74abjOu3I+CeZXi7G7UFiuXyZ2mL5kaTTHbv9RQLvOt+7CJqyfYafOxo+1QjyD jmJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D+zE054l+MqhuQhW7ZhFxFOtodBT53aNohUvmHGyfeo=; b=SuyHcAR92+nAFRhKJWBnKjs7kvwzcb2aGiKefvo70ZcYpVZ0Yp4pkZJe0PdWhWXGFf aUjyC05hUyrtxTd5w+tlkUt9kU9Aj0s0/HpGvYkdkF3EwB00QjMk+l7//RnVmfj1cFNh vgcrwPc4FKPIwHqvmtlZ5X7Xdgn3wp1dAuzWlGMfIcOPT0zyMXKnydBJnFSshUfIt3zt KjutqZXhsj3Mb1HPQn4uqb2/0+ZyUuKESemkUyxHPwOYii4cYch6iCnNEadR7Uhd0JOR KYKQItdFu5/Iwt8y7mIgWnKOTQev/10dK0kY1jBshj6QIS5/Vb16+PTC/s8hnN02hkaq u7YQ== X-Gm-Message-State: AJIora/5aV6ItmkOkgW5yrRRO8FW4xaqPiZLf+lku7myLk0leFeVXXS+ DKX8YcB/hY2BtVFxPs6Rqrvg3+JimuA= X-Google-Smtp-Source: AGRyM1u3rQoHC9ZNrQH9OMMQolNWPElpLJgRSBjOBBL8lCR0sl0nnosRoWmlLkegAXuQwbD8CstM3Q== X-Received: by 2002:a9d:6d17:0:b0:61c:b016:bd32 with SMTP id o23-20020a9d6d17000000b0061cb016bd32mr387600otp.74.1658164945955; Mon, 18 Jul 2022 10:22:25 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:25 -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?C=C3=A9dric_Le_Goater?= Subject: [PULL 05/30] ppc: Remove unused irq_inputs Date: Mon, 18 Jul 2022 14:21:43 -0300 Message-Id: <20220718172208.1247624-6-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32e; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x32e.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Cédric Le Goater Signed-off-by: Cédric Le Goater Reviewed-by: Peter Maydell Message-Id: <20220705145814.461723-6-clg@kaod.org> Signed-off-by: Daniel Henrique Barboza --- target/ppc/cpu.h | 1 - target/ppc/cpu_init.c | 5 ----- 2 files changed, 6 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 7aaff9dcc5..9b8d001f1c 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1184,7 +1184,6 @@ struct CPUArchState { * by recent Book3s compatible CPUs (POWER7 and newer). */ uint32_t irq_input_state; - void **irq_inputs; target_ulong excp_vectors[POWERPC_EXCP_NB]; /* Exception vectors */ target_ulong excp_prefix; diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 86ad28466a..769031375d 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -6678,7 +6678,6 @@ static void init_ppc_proc(PowerPCCPU *cpu) #if !defined(CONFIG_USER_ONLY) int i; - env->irq_inputs = NULL; /* Set all exception vectors to an invalid address */ for (i = 0; i < POWERPC_EXCP_NB; i++) { env->excp_vectors[i] = (target_ulong)(-1ULL); @@ -6808,10 +6807,6 @@ static void init_ppc_proc(PowerPCCPU *cpu) /* Pre-compute some useful values */ env->tlb_per_way = env->nb_tlb / env->nb_ways; } - if (env->irq_inputs == NULL) { - warn_report("no internal IRQ controller registered." - " Attempt QEMU to crash very soon !"); - } #endif if (env->check_pow == NULL) { warn_report("no power management check handler registered." From patchwork Mon Jul 18 17:21:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657589 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=HH8WEbv2; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lmpjn2jtSz9sFr for ; Tue, 19 Jul 2022 03:24:29 +1000 (AEST) Received: from localhost ([::1]:57688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUTr-0008Fz-6X for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:24:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDURz-0007YY-Dw; Mon, 18 Jul 2022 13:22:31 -0400 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]:40571) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDURx-0001fK-2U; Mon, 18 Jul 2022 13:22:31 -0400 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-10c0e6dd55eso25479072fac.7; Mon, 18 Jul 2022 10:22:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=os9AduoJ1gIAScXVgZouLa+p4v5DNDafIjCB8RpIDFM=; b=HH8WEbv2/uWvXqPK6+8yZEG6sImpoe3AvQQqA6H5vDvJ3HlNjz72CdHf+9Vi5uv34z 30RKZM2QdM56kVWMrUTqq0mcGdn7U7mhjHyBCEJVKIAG6PCwvsbbpg15VczFCJIFyzd1 MhOdX+wzEaSXXDY2g7VF6ZnONr0zL5pHEtNQ5yTVVfzyLwUq1FLrc9s+faCDyfuLes0u YXg8G+kzNjJ+8a/oxo9BV0CQATLFDdTnzLpZoXJsf/zfMWQZUiqTE95j8GRHZ1sFBSCR zbekrfr5sc5qQkr5hY5s2GdZikhlGsEVFakN6nuJ1zzgjcs3jlmGBDIeum85BmODo5+0 lCVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=os9AduoJ1gIAScXVgZouLa+p4v5DNDafIjCB8RpIDFM=; b=Go3C8ckG/YNm0GpEeoJZSwOJ7JZwbibkRMn0fUSYe+i88kbcqBSA4Gb9yIF3Kudv/Q zYVxwCoG5jkTL/D3FAQdvCDv1FASHnXlse+JtqMuWFl2EMn8OPYcdbHqG1yaCM4JBAud DaP92nIKz6YTCQkouBtA0thm2Rm+uSpimW3T+FbeGTEwwMjbYw4Af4m5+2VCkE2pGS06 f4w8bOmueoqqfjiZtyZvacnnuJwfVqEdImgG4ao5ahgHmHAlu0mD029onxqRr1pIOW4R TN9E6Cl+yoh9DwD0CtJtn2YPGbU36LzsrWG5WTHzveur6jhOBrvVJk1A34slXN46EXoN PqgA== X-Gm-Message-State: AJIora850MLH+iqi/ab05v0zgcmTbCr+I/jQz9+kwXADg7xik+dFWRWr V5HmJGGM3DuWpEu/XkFog2HJR/5ba+M= X-Google-Smtp-Source: AGRyM1sbYToM/tMbzwmnE6J37RqhkcqQjItLSLbtktEngkhPbCrAWcL9U+JK3um8TzmjtclACpPFhA== X-Received: by 2002:a05:6808:1928:b0:339:f15a:ec8f with SMTP id bf40-20020a056808192800b00339f15aec8fmr16696455oib.35.1658164948001; Mon, 18 Jul 2022 10:22:28 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:27 -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, "Jason A. Donenfeld" Subject: [PULL 06/30] hw/ppc: pass random seed to fdt Date: Mon, 18 Jul 2022 14:21:44 -0300 Message-Id: <20220718172208.1247624-7-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2e; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x2e.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: "Jason A. Donenfeld" If the FDT contains /chosen/rng-seed, then the Linux RNG will use it to initialize early. Set this using the usual guest random number generation function. This is confirmed to successfully initialize the RNG on Linux 5.19-rc6. The rng-seed node is part of the DT spec. Set this on the paravirt platforms, spapr and e500, just as is done on other architectures with paravirt hardware. Cc: Daniel Henrique Barboza Signed-off-by: Jason A. Donenfeld Reviewed-by: Daniel Henrique Barboza Message-Id: <20220712135114.289855-1-Jason@zx2c4.com> Signed-off-by: Daniel Henrique Barboza --- hw/ppc/e500.c | 5 +++++ hw/ppc/spapr.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index 757cfaa62f..32495d0123 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -17,6 +17,7 @@ #include "qemu/osdep.h" #include "qemu/datadir.h" #include "qemu/units.h" +#include "qemu/guest-random.h" #include "qapi/error.h" #include "e500.h" #include "e500-ccsr.h" @@ -346,6 +347,7 @@ static int ppce500_load_device_tree(PPCE500MachineState *pms, }; const char *dtb_file = machine->dtb; const char *toplevel_compat = machine->dt_compatible; + uint8_t rng_seed[32]; if (dtb_file) { char *filename; @@ -403,6 +405,9 @@ static int ppce500_load_device_tree(PPCE500MachineState *pms, if (ret < 0) fprintf(stderr, "couldn't set /chosen/bootargs\n"); + qemu_guest_getrandom_nofail(rng_seed, sizeof(rng_seed)); + qemu_fdt_setprop(fdt, "/chosen", "rng-seed", rng_seed, sizeof(rng_seed)); + if (kvm_enabled()) { /* Read out host's frequencies */ clock_freq = kvmppc_get_clockfreq(); diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 9a5382d527..3a5112899e 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -27,6 +27,7 @@ #include "qemu/osdep.h" #include "qemu/datadir.h" #include "qemu/memalign.h" +#include "qemu/guest-random.h" #include "qapi/error.h" #include "qapi/qapi-events-machine.h" #include "qapi/qapi-events-qdev.h" @@ -1014,6 +1015,7 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset) { MachineState *machine = MACHINE(spapr); SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine); + uint8_t rng_seed[32]; int chosen; _FDT(chosen = fdt_add_subnode(fdt, 0, "chosen")); @@ -1091,6 +1093,9 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset) spapr_dt_ov5_platform_support(spapr, fdt, chosen); } + qemu_guest_getrandom_nofail(rng_seed, sizeof(rng_seed)); + _FDT(fdt_setprop(fdt, chosen, "rng-seed", rng_seed, sizeof(rng_seed))); + _FDT(spapr_dt_ovec(fdt, chosen, spapr->ov5_cas, "ibm,architecture-vec-5")); } From patchwork Mon Jul 18 17:21:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657607 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=oJG9FA6Z; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LmpwZ6wDBz9sFr for ; Tue, 19 Jul 2022 03:33:50 +1000 (AEST) Received: from localhost ([::1]:49724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUcu-0005jU-PE for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:33:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUS2-0007iM-Fx; Mon, 18 Jul 2022 13:22:34 -0400 Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]:40567) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUS0-0001fh-Vo; Mon, 18 Jul 2022 13:22:34 -0400 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-10c0e6dd55eso25479601fac.7; Mon, 18 Jul 2022 10:22:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aRFmRcNgd5GC2DIArjbokwij580jaxeWpwS8D8SMqH4=; b=oJG9FA6ZJBSO0zk2LdKXQUiYoZKfZilqd/bCGfzUt7jo53BL3xPuQZm6I6mQ0zO9uN 6u1Y1OYli9ytYcUr1PZaSSrkRiI43yjJnpeTU0+AGeA17yE3ua/O0kps4oChcXbnhL2y e/XyR0ZLwqM0ffrj31iHTex0bO7+jRqgwAGvHaTRWrPk5SOef37PBzM8/ybIu8P2JcpZ WRawiwyNIArVoXXUgExBBCo1v4a1pGU4rFKwhawuB+76/KsFSiOeDYtYLREEuuvX3WKp O01KWVzkFMj/jhtbVEHuteSE9T1OdE0zHX9FvH7EdFTC0a3pxyXmUvSchDhOSc7ckH71 CYxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aRFmRcNgd5GC2DIArjbokwij580jaxeWpwS8D8SMqH4=; b=phA/SWqWTAH+IAZWPpSi7DxAX2knOjghDJQjoVDV8/aHE1UnAubVEWCap8frYSLEtP pabFynGudnxU3mC4gxBjWF51/d99ac0zRRe9nGaTin1VGA+GjO8bzIIovwRIQKSyMiKQ 6re0dsVcJx2A4zC+aQW4nPvoaOFuIa+BkJ0nQbxyPm7gblMu2liJPLYPuOYspwWYbby8 b64m7bhwfS1YSQVOVPFYTHtiK1aNbZ/Wkz+KBboQ1Lqvb5iy8BU6gvP0qPMVHcWq05Rv nUIJOtkEBSpccGxuJh8h9HgE+3454lysWMRN59BGluG7jq2CUOPeGxuYdjl0uaY4uIXP pHAQ== X-Gm-Message-State: AJIora92AlCfvaGNfCRo8L8whC0sEr1NTr5hQ4f5J47zBray4+rC7bAS DHCBB5YLyLd+Lvs286wkTYWijvBye+U= X-Google-Smtp-Source: AGRyM1vjw8G7paRQSswhuzbZZpGxe/m9aFi1fGGSaQv5icPEjf3G31Fsy3dsQJFspdtJNuz5lzp/8A== X-Received: by 2002:a05:6808:bd6:b0:337:92db:df12 with SMTP id o22-20020a0568080bd600b0033792dbdf12mr13711669oik.135.1658164950435; Mon, 18 Jul 2022 10:22:30 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:30 -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, Murilo Opsfelder Araujo , David Gibson Subject: [PULL 07/30] target/ppc/kvm: Skip current and parent directories in kvmppc_find_cpu_dt Date: Mon, 18 Jul 2022 14:21:45 -0300 Message-Id: <20220718172208.1247624-8-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::29; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x29.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Murilo Opsfelder Araujo Some systems have /proc/device-tree/cpus/../clock-frequency. However, this is not the expected path for a CPU device tree directory. Signed-off-by: Murilo Opsfelder Araujo Signed-off-by: Fabiano Rosas Reviewed-by: David Gibson Reviewed-by: Daniel Henrique Barboza Message-Id: <20220712210810.35514-1-muriloo@linux.ibm.com> Signed-off-by: Daniel Henrique Barboza --- target/ppc/kvm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 6eed466f80..466d0d2f4c 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1877,6 +1877,12 @@ static int kvmppc_find_cpu_dt(char *buf, int buf_len) buf[0] = '\0'; while ((dirp = readdir(dp)) != NULL) { FILE *f; + + /* Don't accidentally read from the current and parent directories */ + if (strcmp(dirp->d_name, ".") == 0 || strcmp(dirp->d_name, "..") == 0) { + continue; + } + snprintf(buf, buf_len, "%s%s/clock-frequency", PROC_DEVTREE_CPU, dirp->d_name); f = fopen(buf, "r"); From patchwork Mon Jul 18 17:21:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657600 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=GQN7mRln; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lmpqy39Nlz9sFr for ; Tue, 19 Jul 2022 03:29:50 +1000 (AEST) Received: from localhost ([::1]:40644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUZ2-0007uF-5d for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:29:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUS3-0007ko-VO; Mon, 18 Jul 2022 13:22:36 -0400 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]:37789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUS2-0001iF-48; Mon, 18 Jul 2022 13:22:35 -0400 Received: by mail-ot1-x331.google.com with SMTP id l9-20020a056830268900b006054381dd35so9714707otu.4; Mon, 18 Jul 2022 10:22:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fvMJGexYC/ksWQD6tsUlIN56DwNKHAX6EOUQY7Vofe4=; b=GQN7mRlnAcUJ1F3G9Tf/tx4rX2dA4PSKWivlH5GbYnX/xqtc1VhlJOLh1zuE36tXwH HR7LmcJyL3uUH+hOxufQCuUudU/HHmhkAzriGsc7v8taALzUgkcijURdgQwjvcMxSGz4 FCOqFkpp9wAV8bsbTBeyTre0si7fpVDeS6Eu1vcR812KvXJeKCFn0lHkUZkBz4tu3K1i exau3SPY3UUut4txSVnzL9q7ZIIWW/A8whP1jB1EyxFbVA7PZUAiIGeqHpcmhEm0dE9p Y3i2VVHgvOxjly0G4f++TzFqwTmD/Km8tqlsDmLQh7mQT/nbiuQ/oGC1IDHaiM7hGOAG DkKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fvMJGexYC/ksWQD6tsUlIN56DwNKHAX6EOUQY7Vofe4=; b=M8RenVwZeHrYDY2oM04Y++dQPGoTvC9ZMw0Ru4OQHOSdGTekZCN+h6H83ak02mmqXY e286vCYqLPSVqT0o4COjS8xoREUjPLIUMIArVWjyeRNAs90tTNI11rBSgUUfIfJAgyWj vKhX0euogw5TCgOGjqGnkXMMWEEYzI5EbGdTvj3okKOAs8cV4qZsn5ELqK1+S52lPg2B Eaxu0yjiKcKtmi3c4uMh3IJgqmimoh+lSRtK5AopzDiaiNjXN44hcKW1+tjF37gErkuv zb3duoST4hcFnFAiNTjaPIJi5Q2iR3B5kaPVCXC7BBGKjdMJnUpWMG1l5ra470I+lJ4m uxAA== X-Gm-Message-State: AJIora9aXS2dIqWGpAGYhpNhav/B6jW9AoyMXWmyJgEBD+9BslcUFxFP zvTCTXrpRWxmDLNRUiP+WVTbW6A8SSw= X-Google-Smtp-Source: AGRyM1tZT0Zv+NIIqqpgjobsr6IQE0e92Pv2y1DCT1SHvwQTfTLr21+GzIuN/svT1/8c2+ftDgArXA== X-Received: by 2002:a05:6830:61cd:b0:618:d560:b787 with SMTP id cc13-20020a05683061cd00b00618d560b787mr11945137otb.154.1658164952982; Mon, 18 Jul 2022 10:22:32 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:32 -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, Matheus Ferst , Fabiano Rosas Subject: [PULL 08/30] target/ppc: Fix gen_priv_exception error value in mfspr/mtspr Date: Mon, 18 Jul 2022 14:21:46 -0300 Message-Id: <20220718172208.1247624-9-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::331; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x331.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Matheus Ferst The code in linux-user/ppc/cpu_loop.c expects POWERPC_EXCP_PRIV exception with error POWERPC_EXCP_PRIV_OPC or POWERPC_EXCP_PRIV_REG, while POWERPC_EXCP_INVAL_SPR is expected in POWERPC_EXCP_INVAL exceptions. This mismatch caused an EXCP_DUMP with the message "Unknown privilege violation (03)", as seen in [1]. [1] https://gitlab.com/qemu-project/qemu/-/issues/588 Fixes: 9b2fadda3e01 ("ppc: Rework generation of priv and inval interrupts") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/588 Reviewed-by: Fabiano Rosas Signed-off-by: Matheus Ferst Message-Id: <20220627141104.669152-2-matheus.ferst@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/translate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 1d6daa4608..55f34eb490 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -4789,11 +4789,11 @@ static inline void gen_op_mfspr(DisasContext *ctx) */ if (sprn & 0x10) { if (ctx->pr) { - gen_priv_exception(ctx, POWERPC_EXCP_INVAL_SPR); + gen_priv_exception(ctx, POWERPC_EXCP_PRIV_REG); } } else { if (ctx->pr || sprn == 0 || sprn == 4 || sprn == 5 || sprn == 6) { - gen_hvpriv_exception(ctx, POWERPC_EXCP_INVAL_SPR); + gen_hvpriv_exception(ctx, POWERPC_EXCP_PRIV_REG); } } } @@ -4976,11 +4976,11 @@ static void gen_mtspr(DisasContext *ctx) */ if (sprn & 0x10) { if (ctx->pr) { - gen_priv_exception(ctx, POWERPC_EXCP_INVAL_SPR); + gen_priv_exception(ctx, POWERPC_EXCP_PRIV_REG); } } else { if (ctx->pr || sprn == 0) { - gen_hvpriv_exception(ctx, POWERPC_EXCP_INVAL_SPR); + gen_hvpriv_exception(ctx, POWERPC_EXCP_PRIV_REG); } } } From patchwork Mon Jul 18 17:21:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657615 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=MGYEA/TX; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lmq0z28fJz9sFr for ; Tue, 19 Jul 2022 03:37:37 +1000 (AEST) Received: from localhost ([::1]:58230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUgY-0003T6-4M for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:37:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUS7-0007pa-Pw; Mon, 18 Jul 2022 13:22:43 -0400 Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]:43789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUS5-0001nG-3S; Mon, 18 Jul 2022 13:22:38 -0400 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-10d4691a687so10211685fac.10; Mon, 18 Jul 2022 10:22:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ThB98apRfBs5yvy4V1cZpA2KNQJrOdvKbcBXWZJUT9U=; b=MGYEA/TXELANhJRzXP3FAolhgD9Z84SX6KO07Kt4bLgYiR6Sp/s/B+g3S2bbCdtv9p nOMSDZ/BQ4XDWJF6v54yYXmpgRK+815Wjx5T3jP0Lgf9hqLEyK8V+kPXfsU+npqvEK/r 5haKAI3hbsBE1gmBHKwLmTEV2Hj2vVWM2y4YGuyqNxsvwkbcuQYXg6kMp9kKnXWyQoxk xSAsr9/8e/dY1CJXV7Jz98GkauLyORoqck5D9vqZ6PONKKc6shzMgvhAWONIYlsbLp3y 4Q+Xd+gx+g5ipSrYNff+9T0M0zo30RmdLG26U61TzT+PHzEzotKw2LE0UPBB+GCUKo7e 3f3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ThB98apRfBs5yvy4V1cZpA2KNQJrOdvKbcBXWZJUT9U=; b=xUPPlh+VhCNL4kEJVwf5msvZOEhiY7WjAJNY1zoowvsfE0J1XXzhyRSvD/xocOjp9L 8AQr9q4QI4mC+1rfRDDo35XVUQ7vvoJb8MFSA2jOvrA0mFzLwIGjExjlijTBGR/W22wm gvrP5e+VRazorHsabWKiTjUwhKBDqy6x4g3WfW8edghI1IwpwcuE9vEKm7UE79D7L6IO Xk+HabGwd+cp2m/y3//ZQDlxYuTyT+Yk6k28BDFYDZbrQCfDp1NqW9IgKKAbVq/LM4AY 2sbl/BDSTmOc9N5tXDFQslF/OCehncYNUj41la7hLOoyFmtvIVfK3KSFqJvTxANBd7YH Wleg== X-Gm-Message-State: AJIora8UL5qmmnMWTH2O2J/zqyhaSug8LK+b67wDSfFcGhQJT18zBsoU juEQfuJVRxbOYqFK1FfNMVv3r3qR4ow= X-Google-Smtp-Source: AGRyM1tqHM1blmikJTUp1FGSgA7iHUAJ9Jl6yzPHnapO2jR3L2qjeyeI3TdcaPM+48OnlfFkeNo93w== X-Received: by 2002:a05:6870:c210:b0:10b:f1b9:94 with SMTP id z16-20020a056870c21000b0010bf1b90094mr17849853oae.238.1658164955536; Mon, 18 Jul 2022 10:22:35 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:35 -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, Matheus Ferst , Laurent Vivier Subject: [PULL 09/30] target/ppc: fix exception error value in slbfee Date: Mon, 18 Jul 2022 14:21:47 -0300 Message-Id: <20220718172208.1247624-10-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::29; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x29.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Matheus Ferst Testing on a POWER9 DD2.3, we observed that the Linux kernel delivers a signal with si_code ILL_PRVOPC (5) when a userspace application tries to use slbfee. To obtain this behavior on linux-user, we should use POWERPC_EXCP_PRIV with POWERPC_EXCP_PRIV_OPC. No functional change is intended for softmmu targets as gen_hvpriv_exception uses the same 'exception' argument (POWERPC_EXCP_HV_EMU) for raise_exception_*, and the powerpc_excp_* methods do not use lower bits of the exception error code when handling POWERPC_EXCP_{INVAL,PRIV}. Reported-by: Laurent Vivier Signed-off-by: Matheus Ferst Reviewed-by: Daniel Henrique Barboza Message-Id: <20220627141104.669152-3-matheus.ferst@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 55f34eb490..d7e5670c20 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -5386,12 +5386,12 @@ static void gen_slbmfev(DisasContext *ctx) static void gen_slbfee_(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); + gen_hvpriv_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else TCGLabel *l1, *l2; if (unlikely(ctx->pr)) { - gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); + gen_hvpriv_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } gen_helper_find_slb_vsid(cpu_gpr[rS(ctx->opcode)], cpu_env, From patchwork Mon Jul 18 17:21:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657608 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=EjDRMhhI; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lmpwd3Xj1z9sFr for ; Tue, 19 Jul 2022 03:33:53 +1000 (AEST) Received: from localhost ([::1]:49866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUcx-0005pm-9o for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:33:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSB-0007qj-R2; Mon, 18 Jul 2022 13:22:45 -0400 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]:37609) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUS7-0001np-Sc; Mon, 18 Jul 2022 13:22:43 -0400 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-10c0430e27dso25533150fac.4; Mon, 18 Jul 2022 10:22:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dLFxcjQN2SbHaIgjOt/ARXomHBw7Avrk1GienFRJ37M=; b=EjDRMhhIXYNjr2CSrK0XL23EjTKEtcBYcWom90VRYaz5zZC82ASYRDXV5MsI8gD79p Lb0xVeUiKVoynPfEzPvdr4F8K4SjHWeBow3Yp3Sc90DD1LR6/uaFLvvC62UZwmgGRd6t 8vQNQDMzyg4A/GyZTxlstmYUaAVMPZbq1vTJ/E0PZlaxzDqe3N4OTFbjNhqi3II0Li2e wRWvuX8fvbYMx57sbRsPtejdquvlZ7X14G51+xnSDVj4LcFgztsBOY0skf2/fEte4rBO 8Uk6Xl5WT0LlX4pDZzu917RVbsVCdGQQzbZeWwlvd+u6LdUV4sMcts4OTfF2s2KXcQZ/ 0p/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dLFxcjQN2SbHaIgjOt/ARXomHBw7Avrk1GienFRJ37M=; b=nbt4O0nD7Rs7OHelbJ2F1z3Qq+OThf/dvyz7Q3za72No1F77G9W+4vTK6Q46NFVgeq t6iIsABrpdXm6RnkvtDlCm2QmZeqgqypFFd8DcC6siQ6pklDGt//l/THCZwii3BcYpj+ kKSni3DlW3eyB0IPmHjDSjO/WoHpNiAi3TLbgaI0HdshfbjufOSQPHMiwJYfaOZFcVGc Vvu90pLue/SUhIRgtPx0zB2Fw7+ziuVt4w+ZJdq7hLgGA1NkxEzjejP6ETHJdVfV0PGB RyaVnd8W3eKvdpaLp5ihqkFsY/H1wP8f6xVSlDcijxKOLWOm9CgT7hQNVLH44pA/F0hO ChLQ== X-Gm-Message-State: AJIora9t/Bm3VGvpOepSO+HwPFBeqmRnFy/5OV70Liazj59Rq/Yj8ati 5Zj0rkulHS7Bf6b6vAAANjLfq5EbGtw= X-Google-Smtp-Source: AGRyM1tr4je4QDzzzOoKt3QQI3uUNI92HgUi+ecXc+3CZ7a2WvFuyDHEO6zSjsFXO045sSW2Rh6gRA== X-Received: by 2002:a05:6870:b292:b0:10c:8b96:ed3d with SMTP id c18-20020a056870b29200b0010c8b96ed3dmr15788539oao.171.1658164957928; Mon, 18 Jul 2022 10:22:37 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:37 -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, Matheus Ferst , Fabiano Rosas Subject: [PULL 10/30] target/ppc: remove mfdcrux and mtdcrux Date: Mon, 18 Jul 2022 14:21:48 -0300 Message-Id: <20220718172208.1247624-11-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2e; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x2e.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Matheus Ferst The only PowerPC implementations with these insns were the 460 and 460F, which had their definitions removed in [1]. [1] 7ff26aa6c657 ("target/ppc: Remove unused PPC 460 and 460F definitions") Signed-off-by: Matheus Ferst Reviewed-by: Fabiano Rosas Message-Id: <20220627141104.669152-4-matheus.ferst@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/cpu.h | 6 ++---- target/ppc/translate.c | 18 ------------------ 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 9b8d001f1c..a4c893cfad 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -2214,8 +2214,6 @@ enum { PPC_DCR = 0x1000000000000000ULL, /* DCR extended accesse */ PPC_DCRX = 0x2000000000000000ULL, - /* user-mode DCR access, implemented in PowerPC 460 */ - PPC_DCRUX = 0x4000000000000000ULL, /* popcntw and popcntd instructions */ PPC_POPCNTWD = 0x8000000000000000ULL, @@ -2239,8 +2237,8 @@ enum { | PPC_405_MAC | PPC_440_SPEC | PPC_BOOKE \ | PPC_MFAPIDI | PPC_TLBIVA | PPC_TLBIVAX \ | PPC_4xx_COMMON | PPC_40x_ICBT | PPC_RFMCI \ - | PPC_RFDI | PPC_DCR | PPC_DCRX | PPC_DCRUX \ - | PPC_POPCNTWD | PPC_CILDST) + | PPC_RFDI | PPC_DCR | PPC_DCRX | PPC_POPCNTWD \ + | PPC_CILDST) /* extended type values */ diff --git a/target/ppc/translate.c b/target/ppc/translate.c index d7e5670c20..30dd524959 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -5907,22 +5907,6 @@ static void gen_mtdcrx(DisasContext *ctx) #endif /* defined(CONFIG_USER_ONLY) */ } -/* mfdcrux (PPC 460) : user-mode access to DCR */ -static void gen_mfdcrux(DisasContext *ctx) -{ - gen_helper_load_dcr(cpu_gpr[rD(ctx->opcode)], cpu_env, - cpu_gpr[rA(ctx->opcode)]); - /* Note: Rc update flag set leads to undefined state of Rc0 */ -} - -/* mtdcrux (PPC 460) : user-mode access to DCR */ -static void gen_mtdcrux(DisasContext *ctx) -{ - gen_helper_store_dcr(cpu_env, cpu_gpr[rA(ctx->opcode)], - cpu_gpr[rS(ctx->opcode)]); - /* Note: Rc update flag set leads to undefined state of Rc0 */ -} - /* dccci */ static void gen_dccci(DisasContext *ctx) { @@ -6958,8 +6942,6 @@ GEN_HANDLER(mfdcr, 0x1F, 0x03, 0x0A, 0x00000001, PPC_DCR), GEN_HANDLER(mtdcr, 0x1F, 0x03, 0x0E, 0x00000001, PPC_DCR), GEN_HANDLER(mfdcrx, 0x1F, 0x03, 0x08, 0x00000000, PPC_DCRX), GEN_HANDLER(mtdcrx, 0x1F, 0x03, 0x0C, 0x00000000, PPC_DCRX), -GEN_HANDLER(mfdcrux, 0x1F, 0x03, 0x09, 0x00000000, PPC_DCRUX), -GEN_HANDLER(mtdcrux, 0x1F, 0x03, 0x0D, 0x00000000, PPC_DCRUX), GEN_HANDLER(dccci, 0x1F, 0x06, 0x0E, 0x03E00001, PPC_4xx_COMMON), GEN_HANDLER(dcread, 0x1F, 0x06, 0x0F, 0x00000001, PPC_4xx_COMMON), GEN_HANDLER2(icbt_40x, "icbt", 0x1F, 0x06, 0x08, 0x03E00001, PPC_40x_ICBT), From patchwork Mon Jul 18 17:21:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657621 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=NosPw521; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lmq6G6JZQz9sFr for ; Tue, 19 Jul 2022 03:42:14 +1000 (AEST) Received: from localhost ([::1]:39044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUl2-0001zj-Kv for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:42:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSD-0007qr-A6; Mon, 18 Jul 2022 13:22:46 -0400 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]:37789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSA-0001iF-Jt; Mon, 18 Jul 2022 13:22:44 -0400 Received: by mail-ot1-x331.google.com with SMTP id l9-20020a056830268900b006054381dd35so9715049otu.4; Mon, 18 Jul 2022 10:22:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sD+YNABs2LjOHi8LN8fzLMnu0iUTB68Z93In0DoQXKI=; b=NosPw521rznf1eqBzm939HhxrFffZMKa562+7NX8obks+OaK6VNxo34dX6AJTvba6v 0cMALdP1KkmmTowhpr+YjjzUYN0ItQuZEgIqIBIznAjmmKI5sN6fxbEOfY6Fo/ALTFle zbIxABwTiXHvb7mwHKIMyb0LXaySq+zJoXAzhNm7j1/ls+MSiluFCQygz7PzVMBs4yrm pY73HE+NqfR0d1Cs//jZ+1PoV40QdnLfnQo5fpFkDzUpcuWH6R01RbZQhOwcf9uSPmZN 65FwKrTtyA5oQzzpQCyYlXXoDWw6sFg7g1HGjPaYglTJSfhz67ZxBg4yMQBXhg7LmH1h PL5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sD+YNABs2LjOHi8LN8fzLMnu0iUTB68Z93In0DoQXKI=; b=2iPllCtGofkcuaizAnG6b6nBUCEDW6VQMOMda25UOtmVg8GLu8P6sID70ENB5ILB1B wj16YPrM4ftRyYEXnVShVMUcHy4VNYqDQ0UovJcY9JxA1ZB+c20ogDZUOhgmRCGNyfdB z3XReKJama1N0ON+zlLtwx//wxWHKqdfriw8oJZHa18kK5dFbX+cbrt71U8FXKmwoA52 CK84lKpCwWbJ7MNOctcnU28UeQlnyPlpDNlQy1pfFPi97iEcZ7tY9lgdfeyNN27MbIf7 ki9ej6xA2FsR9Wo6kqj7YlpnnXrdEIptp3CQ5fRLIZ46g61QKkbvrCo1h3iZYr8czvG3 VSWg== X-Gm-Message-State: AJIora/M/CDLmxKhVofX1OPXr9ElJy0TltOBOGHtUZ17MrMy4eh00yiL e7q9zPcuUGnLm8xSsA26eVNRgk9NtN8= X-Google-Smtp-Source: AGRyM1vAAdZljQEfyIqwOvwRGVF9Ay8S69PQPnn/EPu3kO9mMYmNGzCjG/qvUKPBqS0tUtQODeKnBA== X-Received: by 2002:a9d:6945:0:b0:61c:81f2:733b with SMTP id p5-20020a9d6945000000b0061c81f2733bmr7326472oto.241.1658164960327; Mon, 18 Jul 2022 10:22:40 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:40 -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, Matheus Ferst , Laurent Vivier Subject: [PULL 11/30] target/ppc: fix exception error code in helper_{load, store}_dcr Date: Mon, 18 Jul 2022 14:21:49 -0300 Message-Id: <20220718172208.1247624-12-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::331; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x331.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Matheus Ferst POWERPC_EXCP_INVAL should only be or-ed with other constants prefixed with POWERPC_EXCP_INVAL_. Also, take the opportunity to move both helpers under #if !defined(CONFIG_USER_ONLY) as the instructions that use them are privileged. No functional change is intended, the lower 4 bits of the error code are ignored by all powerpc_excp_* methods on POWERPC_EXCP_INVAL exceptions. Reported-by: Laurent Vivier Signed-off-by: Matheus Ferst Reviewed-by: Daniel Henrique Barboza Message-Id: <20220627141104.669152-5-matheus.ferst@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/helper.h | 2 +- target/ppc/timebase_helper.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index ed0641a234..2f112b7de0 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -694,10 +694,10 @@ DEF_HELPER_2(book3s_msgclr, void, env, tl) DEF_HELPER_4(dlmzb, tl, env, tl, tl, i32) #if !defined(CONFIG_USER_ONLY) DEF_HELPER_2(rac, tl, env, tl) -#endif DEF_HELPER_2(load_dcr, tl, env, tl) DEF_HELPER_3(store_dcr, void, env, tl, tl) +#endif DEF_HELPER_2(load_dump_spr, void, env, i32) DEF_HELPER_2(store_dump_spr, void, env, i32) diff --git a/target/ppc/timebase_helper.c b/target/ppc/timebase_helper.c index 86d01d6e4e..b80f56af7e 100644 --- a/target/ppc/timebase_helper.c +++ b/target/ppc/timebase_helper.c @@ -143,7 +143,6 @@ void helper_store_booke_tsr(CPUPPCState *env, target_ulong val) { store_booke_tsr(env, val); } -#endif /*****************************************************************************/ /* Embedded PowerPC specific helpers */ @@ -169,7 +168,7 @@ target_ulong helper_load_dcr(CPUPPCState *env, target_ulong dcrn) (uint32_t)dcrn, (uint32_t)dcrn); raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM, POWERPC_EXCP_INVAL | - POWERPC_EXCP_PRIV_REG, GETPC()); + POWERPC_EXCP_INVAL_INVAL, GETPC()); } } return val; @@ -192,7 +191,8 @@ void helper_store_dcr(CPUPPCState *env, target_ulong dcrn, target_ulong val) (uint32_t)dcrn, (uint32_t)dcrn); raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM, POWERPC_EXCP_INVAL | - POWERPC_EXCP_PRIV_REG, GETPC()); + POWERPC_EXCP_INVAL_INVAL, GETPC()); } } } +#endif From patchwork Mon Jul 18 17:21:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657616 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=KUON5ZBY; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lmq1T43xnz9sFr for ; Tue, 19 Jul 2022 03:38:05 +1000 (AEST) Received: from localhost ([::1]:59244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUh1-0004Lu-CD for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:38:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSG-0007tr-Ls; Mon, 18 Jul 2022 13:22:48 -0400 Received: from mail-oa1-x2b.google.com ([2001:4860:4864:20::2b]:44658) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSF-0001op-06; Mon, 18 Jul 2022 13:22:48 -0400 Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-10bd4812c29so25489091fac.11; Mon, 18 Jul 2022 10:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K+sz4ClhBi1qJo9v1UC6b8pJgTN/doSDoBgt8dgJCSw=; b=KUON5ZBYo8W7xS3hr3dqk4Itj7f7QqemgqbAVRetQxUY4Hp1BTqnwf6wrWLFwN9P9O QwAYwIH7n4vz10cxOKQ+EdZgN3pDwDLW4Uyx4sGojlVkGDSzTpX8SYGZm91O9MCXAPtb rbnVLGUR02jh185ONq+VBf7eNuukKYfJmzAZSbQUj3KgoOszEALF8Xy3iKNKff2dXZNH 8WixXj3Mx9s1tj0um6xVO1tyy0xCotpdJnQyZDhezyFxRy3/EsoWUqYorMTIPDHCXzMo 2RuNHuMpQ/nthQ6nod7hb4SEU2OOfxhc85T4vKaf9Ye5rsx8NqQ8AJduRvtC6oDKE9FO rjEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K+sz4ClhBi1qJo9v1UC6b8pJgTN/doSDoBgt8dgJCSw=; b=ymomFt0S69lMesrVeQUStojv9EOMg/yqbupkbQyA0tMm78rFqPhl7VLFaBn4pqO0ZQ Lcpvc4ehYK7qTmAXTXn9HAEk7aj06rgffDYCGFJ8C4dFtEDUsvcn+mkzd4xjtBLWUpCe Dvm2UeDORBcDNgeLF+64v9MHifwqBOZwIYQHImt9MHF2ImYz4kXwQ3pm3YXuQgR5cASL wUeNmEn+c0X5vBWmqbWZ/oIJnpaF6OK9/I/jVB23Pwm8Q3/1TVo1L/hAzvhrcjDcDNlk l7WTflgcy4BlWtjJuIlkJ43tp+dYBOJuOYhje04MnT3TD/CqqbOeXe9ei0OweLHkZ27k ik/A== X-Gm-Message-State: AJIora/kYY2GTcEKYsa4Rj2bCNLeXuWOomEVseAEsq5eso/madc49mhv p/X27Ynx1d3CfSrjhPs6+ky/5KAnVs0= X-Google-Smtp-Source: AGRyM1sDG4XfkpDZO7Hf+EQJ8j8IfTLQ9pgYxfRfXoF6Hxr1YbMLEb+PLA0rp0ZMuI0DswVF68mr8w== X-Received: by 2002:a05:6808:210d:b0:33a:6081:dc84 with SMTP id r13-20020a056808210d00b0033a6081dc84mr6470408oiw.154.1658164962723; Mon, 18 Jul 2022 10:22:42 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:42 -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, Matheus Ferst Subject: [PULL 12/30] target/ppc: fix PMU Group A register read/write exceptions Date: Mon, 18 Jul 2022 14:21:50 -0300 Message-Id: <20220718172208.1247624-13-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2b; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x2b.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Matheus Ferst A call to "gen_(hv)priv_exception" should use POWERPC_EXCP_PRIV_* as the 'error' argument instead of POWERPC_EXCP_INVAL_*, and POWERPC_EXCP_FU is an exception type, not an exception error code. To correctly set FSCR[IC], we should raise Facility Unavailable with this exception type and IC value as the error code. Fixes: 565cb1096733 ("target/ppc: add user read/write functions for MMCR0") Signed-off-by: Matheus Ferst Reviewed-by: Daniel Henrique Barboza Message-Id: <20220627141104.669152-6-matheus.ferst@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/power8-pmu-regs.c.inc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/ppc/power8-pmu-regs.c.inc b/target/ppc/power8-pmu-regs.c.inc index 2bab6cece7..c3cc919ee4 100644 --- a/target/ppc/power8-pmu-regs.c.inc +++ b/target/ppc/power8-pmu-regs.c.inc @@ -22,7 +22,7 @@ static bool spr_groupA_read_allowed(DisasContext *ctx) { if (!ctx->mmcr0_pmcc0 && ctx->mmcr0_pmcc1) { - gen_hvpriv_exception(ctx, POWERPC_EXCP_FU); + gen_exception_err(ctx, POWERPC_EXCP_FU, FSCR_IC_PMU); return false; } @@ -46,10 +46,10 @@ static bool spr_groupA_write_allowed(DisasContext *ctx) if (ctx->mmcr0_pmcc1) { /* PMCC = 0b01 */ - gen_hvpriv_exception(ctx, POWERPC_EXCP_FU); + gen_exception_err(ctx, POWERPC_EXCP_FU, FSCR_IC_PMU); } else { /* PMCC = 0b00 */ - gen_hvpriv_exception(ctx, POWERPC_EXCP_INVAL_SPR); + gen_hvpriv_exception(ctx, POWERPC_EXCP_PRIV_REG); } return false; @@ -214,7 +214,7 @@ void spr_read_PMC56_ureg(DisasContext *ctx, int gprn, int sprn) * Interrupt. */ if (ctx->mmcr0_pmcc0 && ctx->mmcr0_pmcc1) { - gen_hvpriv_exception(ctx, POWERPC_EXCP_FU); + gen_exception_err(ctx, POWERPC_EXCP_FU, FSCR_IC_PMU); return; } @@ -249,7 +249,7 @@ void spr_write_PMC56_ureg(DisasContext *ctx, int sprn, int gprn) * Interrupt. */ if (ctx->mmcr0_pmcc0 && ctx->mmcr0_pmcc1) { - gen_hvpriv_exception(ctx, POWERPC_EXCP_FU); + gen_exception_err(ctx, POWERPC_EXCP_FU, FSCR_IC_PMU); return; } From patchwork Mon Jul 18 17:21:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657622 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=SwySCPkq; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lmq6L5Lvcz9sFr for ; Tue, 19 Jul 2022 03:42:18 +1000 (AEST) Received: from localhost ([::1]:39332 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUl6-0002CO-Ju for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:42:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSG-0007tp-FY; Mon, 18 Jul 2022 13:22:48 -0400 Received: from mail-oa1-x34.google.com ([2001:4860:4864:20::34]:39748) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSF-0001pL-0M; Mon, 18 Jul 2022 13:22:48 -0400 Received: by mail-oa1-x34.google.com with SMTP id 586e51a60fabf-10c0119dd16so25522888fac.6; Mon, 18 Jul 2022 10:22:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Mw+Vl7qJFaRHvBXWjasQlSulEgxJHWWFDxforAjHB7o=; b=SwySCPkqKHMSVO3p4tQqXGEwLMK4eaGzUMDrjnRd1Hj/EvQcRDZBgN2QZyu7uA20Hd 66GnLg3cP2dts0OlEs56jH6namQBbiJ/vqFBphzWxK6lGwdRNPJ7LvZc5nux8kHcisVd FwvYoyGVy4nBm2Uwc1qHRnps8pE9k4DO0ovDNmQShd6EAu7d3YvZB+6vjwURctoVvOGr kLjDyG5T7OSYukUV1AhSoHk7/TmZyR53UFqyzPzlD3YpLVQMypCTAI//LpgoBu017Era 4dF5hDS8bgDZONk/qQB/exdlBM7qogjyI7jqCxQ/kbEdgCPVrM9+0KLvVnXQzD2C6/Sd t1jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Mw+Vl7qJFaRHvBXWjasQlSulEgxJHWWFDxforAjHB7o=; b=isHeZ7Iqa9bG9+igtyEI5H38OMQaV5rqowD1D6ASzDhtR4C4vJB+q63aAwJLBEP70f +bqXdYiXN53wkbU15aeH3USKh5Q44p9FIVyytrwIowxCJDiNHpdwNJXbViF87qdJ3Hau 0ycziw98Dsz9fXI6NEyAgfGD2F64BRTsbVg7PU9JejXz8RNfpxHGOrPi4nNXIlZJ1t3w HtpGY3Fj11sc5SIT29ReiStOgK1sEx0yMhYeP+ifC8jZ/frSbabqZmb5Ue/R8Cdzn826 eu/wuiOvddadbUSMMToJYDjAcX+lsX+2XDI0Wo0bf2k9WNx2FUac5+rpWpGw97v9FiRh zyTQ== X-Gm-Message-State: AJIora8dfCETRzZtuH6JRkmM9UbVxrSket7785pjutMNzt8uoh9ahafH RkjyLRexrruiSZu8SW1gFMVQsfZ7zRg= X-Google-Smtp-Source: AGRyM1skvD04DN+wos+mTe7GHV3PaInyoS6dNBgFRTzQ1m6Hl1HIqxXJTAU3LFx6GJhTumjkA/Z+Vw== X-Received: by 2002:a05:6871:811:b0:10c:32ba:8adc with SMTP id q17-20020a056871081100b0010c32ba8adcmr16279064oap.22.1658164965438; Mon, 18 Jul 2022 10:22:45 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:44 -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, Matheus Ferst Subject: [PULL 13/30] target/ppc: fix exception error code in spr_write_excp_vector Date: Mon, 18 Jul 2022 14:21:51 -0300 Message-Id: <20220718172208.1247624-14-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::34; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x34.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Matheus Ferst The 'error' argument of gen_inval_exception will be or-ed with POWERPC_EXCP_INVAL, so it should always be a constant prefixed with POWERPC_EXCP_INVAL_. No functional change is intended, spr_write_excp_vector is only used by register_BookE_sprs, and powerpc_excp_booke ignores the lower 4 bits of the error code on POWERPC_EXCP_INVAL exceptions. Also, take the opportunity to replace printf with qemu_log_mask. Signed-off-by: Matheus Ferst Reviewed-by: Daniel Henrique Barboza Message-Id: <20220627141104.669152-7-matheus.ferst@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/translate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 30dd524959..da11472877 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -907,9 +907,9 @@ void spr_write_excp_vector(DisasContext *ctx, int sprn, int gprn) } else if (sprn >= SPR_BOOKE_IVOR38 && sprn <= SPR_BOOKE_IVOR42) { sprn_offs = sprn - SPR_BOOKE_IVOR38 + 38; } else { - printf("Trying to write an unknown exception vector %d %03x\n", - sprn, sprn); - gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); + qemu_log_mask(LOG_GUEST_ERROR, "Trying to write an unknown exception" + " vector 0x%03x\n", sprn); + gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); return; } From patchwork Mon Jul 18 17:21:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657629 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=pI+qGsLv; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LmqGQ737gz9sFs for ; Tue, 19 Jul 2022 03:49:18 +1000 (AEST) Received: from localhost ([::1]:48342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUrs-00015e-RM for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:49:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSb-00087B-31; Mon, 18 Jul 2022 13:23:09 -0400 Received: from mail-oa1-x2c.google.com ([2001:4860:4864:20::2c]:39741) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSH-0001pv-Cd; Mon, 18 Jul 2022 13:23:07 -0400 Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-10c0119dd16so25523184fac.6; Mon, 18 Jul 2022 10:22:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5O+lOxgfGYc63X22DZ+LQRrJZY3GJ8jI9PfnGl3F1zY=; b=pI+qGsLvGPP3aECncBAVuW3tJ/5ijaoqsbiG2GovwJygJWiXncqB1ad9iQQpqyqRpO hs51aaF8YEFCL8uMleI1IBjqFtRM8aDShFdtxDKVtzQhOOmY6kzoLLkAM7v/lDm/shP7 wDBDxS4a4dG7moZNkyEruPoqMTIQmgjN2V41yF+AHvevDA0rNA7qCFZSOUIhMLWNb83a YIx7N0vXFtzveuqg7yNA8nasiKFyRcYDk3nI2RMbRQoCLC8kTAdhGcmv0dXod06syKZY 90j6GuiIbHN8Q/SKyN3umxY1Sb9S1m4FQH1JY9wO2K1P32NQtjtO3mVeJebk1BrkRvgM Adew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5O+lOxgfGYc63X22DZ+LQRrJZY3GJ8jI9PfnGl3F1zY=; b=xcGxn09Iy8DHsJT54MGL+dtJbxV3um8cSIZwh/y437rXkLLgyXjq0b9LbpcC3i+JZ5 0HQkjzXFpNcg4a2dKVovb7UPoAIiNfLzPOTwdlGcTkMKm/DIh+Yjku6heeJ06CkFAUDI 983Ar7eP0UcqiFf0q7mR/2NSSg7we9N0J2kfvuMWlnWSvDf+l0YIu7zOlrcxeCUlOLwH ajthICXRmjI1M74Sh0gsixRRkmcu/zOgUIx2t6/sLwyoyplE8hPLOvqNoKfgf7f5yM2A a4ayWRMUlifzkleXrG1NPFbcKF6vE+CNSkJ4T8S+uvgQYEqZ0iyJpiW7M5PGbo2l/5Tw 3K9g== X-Gm-Message-State: AJIora/ARLv3q3aswSSEQUuOiMfRWGXJ/uQXHnM1gbatCfHbUbZgxuHv QM6sfZ7pDjyDO+QJmqXUOKY6AcZm18g= X-Google-Smtp-Source: AGRyM1uBYB3yJwcxmGIYGXn8nZz57Y8lwYaCMymNRlGwE/uhP1Ya10ANz07LNH/CJp+KMUZdwVhXsA== X-Received: by 2002:a05:6870:5712:b0:10b:b268:1681 with SMTP id k18-20020a056870571200b0010bb2681681mr14614857oap.117.1658164967826; Mon, 18 Jul 2022 10:22:47 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:47 -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, Leandro Lupori Subject: [PULL 14/30] target/ppc: Move tlbie[l] to decode tree Date: Mon, 18 Jul 2022 14:21:52 -0300 Message-Id: <20220718172208.1247624-15-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Leandro Lupori Also decode RIC, PRS and R operands. Signed-off-by: Leandro Lupori Reviewed-by: Daniel Henrique Barboza Message-Id: <20220712193741.59134-2-leandro.lupori@eldorado.org.br> [danielhb: mark bit 31 in @X_tlbie pattern as ignored] Signed-off-by: Daniel Henrique Barboza --- target/ppc/cpu_init.c | 4 +- target/ppc/insn32.decode | 8 ++ target/ppc/translate.c | 64 +------------- target/ppc/translate/storage-ctrl-impl.c.inc | 87 ++++++++++++++++++++ 4 files changed, 99 insertions(+), 64 deletions(-) create mode 100644 target/ppc/translate/storage-ctrl-impl.c.inc diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 769031375d..4f2355e941 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -6373,7 +6373,7 @@ POWERPC_FAMILY(POWER9)(ObjectClass *oc, void *data) PPC_FLOAT_EXT | PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | PPC_MEM_SYNC | PPC_MEM_EIEIO | - PPC_MEM_TLBSYNC | + PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_64B | PPC_64H | PPC_64BX | PPC_ALTIVEC | PPC_SEGMENT_64B | PPC_SLBI | PPC_POPCNTB | PPC_POPCNTWD | @@ -6591,7 +6591,7 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data) PPC_FLOAT_EXT | PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | PPC_MEM_SYNC | PPC_MEM_EIEIO | - PPC_MEM_TLBSYNC | + PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_64B | PPC_64H | PPC_64BX | PPC_ALTIVEC | PPC_SEGMENT_64B | PPC_SLBI | PPC_POPCNTB | PPC_POPCNTWD | diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index f7653ef9d5..092e01113f 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -856,3 +856,11 @@ VMODSD 000100 ..... ..... ..... 11111001011 @VX VMODUD 000100 ..... ..... ..... 11011001011 @VX VMODSQ 000100 ..... ..... ..... 11100001011 @VX VMODUQ 000100 ..... ..... ..... 11000001011 @VX + +## TLB Management Instructions + +&X_tlbie rb rs ric prs:bool r:bool +@X_tlbie ...... rs:5 - ric:2 prs:1 r:1 rb:5 .......... - &X_tlbie + +TLBIE 011111 ..... - .. . . ..... 0100110010 - @X_tlbie +TLBIEL 011111 ..... - .. . . ..... 0100010010 - @X_tlbie diff --git a/target/ppc/translate.c b/target/ppc/translate.c index da11472877..440ec8a700 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -5424,64 +5424,6 @@ static void gen_tlbia(DisasContext *ctx) #endif /* defined(CONFIG_USER_ONLY) */ } -/* tlbiel */ -static void gen_tlbiel(DisasContext *ctx) -{ -#if defined(CONFIG_USER_ONLY) - GEN_PRIV; -#else - bool psr = (ctx->opcode >> 17) & 0x1; - - if (ctx->pr || (!ctx->hv && !psr && ctx->hr)) { - /* - * tlbiel is privileged except when PSR=0 and HR=1, making it - * hypervisor privileged. - */ - GEN_PRIV; - } - - gen_helper_tlbie(cpu_env, cpu_gpr[rB(ctx->opcode)]); -#endif /* defined(CONFIG_USER_ONLY) */ -} - -/* tlbie */ -static void gen_tlbie(DisasContext *ctx) -{ -#if defined(CONFIG_USER_ONLY) - GEN_PRIV; -#else - bool psr = (ctx->opcode >> 17) & 0x1; - TCGv_i32 t1; - - if (ctx->pr) { - /* tlbie is privileged... */ - GEN_PRIV; - } else if (!ctx->hv) { - if (!ctx->gtse || (!psr && ctx->hr)) { - /* - * ... except when GTSE=0 or when PSR=0 and HR=1, making it - * hypervisor privileged. - */ - GEN_PRIV; - } - } - - if (NARROW_MODE(ctx)) { - TCGv t0 = tcg_temp_new(); - tcg_gen_ext32u_tl(t0, cpu_gpr[rB(ctx->opcode)]); - gen_helper_tlbie(cpu_env, t0); - tcg_temp_free(t0); - } else { - gen_helper_tlbie(cpu_env, cpu_gpr[rB(ctx->opcode)]); - } - t1 = tcg_temp_new_i32(); - tcg_gen_ld_i32(t1, cpu_env, offsetof(CPUPPCState, tlb_need_flush)); - tcg_gen_ori_i32(t1, t1, TLB_NEED_GLOBAL_FLUSH); - tcg_gen_st_i32(t1, cpu_env, offsetof(CPUPPCState, tlb_need_flush)); - tcg_temp_free_i32(t1); -#endif /* defined(CONFIG_USER_ONLY) */ -} - /* tlbsync */ static void gen_tlbsync(DisasContext *ctx) { @@ -6683,6 +6625,8 @@ static bool resolve_PLS_D(DisasContext *ctx, arg_D *d, arg_PLS_D *a) #include "translate/branch-impl.c.inc" +#include "translate/storage-ctrl-impl.c.inc" + /* Handles lfdp */ static void gen_dform39(DisasContext *ctx) { @@ -6921,10 +6865,6 @@ GEN_HANDLER(tlbia, 0x1F, 0x12, 0x0B, 0x03FFFC01, PPC_MEM_TLBIA), * XXX Those instructions will need to be handled differently for * different ISA versions */ -GEN_HANDLER(tlbiel, 0x1F, 0x12, 0x08, 0x001F0001, PPC_MEM_TLBIE), -GEN_HANDLER(tlbie, 0x1F, 0x12, 0x09, 0x001F0001, PPC_MEM_TLBIE), -GEN_HANDLER_E(tlbiel, 0x1F, 0x12, 0x08, 0x00100001, PPC_NONE, PPC2_ISA300), -GEN_HANDLER_E(tlbie, 0x1F, 0x12, 0x09, 0x00100001, PPC_NONE, PPC2_ISA300), GEN_HANDLER(tlbsync, 0x1F, 0x16, 0x11, 0x03FFF801, PPC_MEM_TLBSYNC), #if defined(TARGET_PPC64) GEN_HANDLER(slbia, 0x1F, 0x12, 0x0F, 0x031FFC01, PPC_SLBI), diff --git a/target/ppc/translate/storage-ctrl-impl.c.inc b/target/ppc/translate/storage-ctrl-impl.c.inc new file mode 100644 index 0000000000..7793297dd4 --- /dev/null +++ b/target/ppc/translate/storage-ctrl-impl.c.inc @@ -0,0 +1,87 @@ +/* + * Power ISA decode for Storage Control instructions + * + * Copyright (c) 2022 Instituto de Pesquisas Eldorado (eldorado.org.br) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Store Control Instructions + */ + +static bool do_tlbie(DisasContext *ctx, arg_X_tlbie *a, bool local) +{ +#if defined(CONFIG_USER_ONLY) + gen_priv_exception(ctx, POWERPC_EXCP_PRIV_OPC); + return true; +#else + TCGv_i32 t1; + int rb; + + rb = a->rb; + + if ((ctx->insns_flags2 & PPC2_ISA300) == 0) { + /* + * Before Power ISA 3.0, the corresponding bits of RIC, PRS, and R + * (and RS for tlbiel) were reserved fields and should be ignored. + */ + a->ric = 0; + a->prs = false; + a->r = false; + if (local) { + a->rs = 0; + } + } + + if (ctx->pr) { + /* tlbie[l] is privileged... */ + gen_priv_exception(ctx, POWERPC_EXCP_PRIV_OPC); + return true; + } else if (!ctx->hv) { + if ((!a->prs && ctx->hr) || (!local && !ctx->gtse)) { + /* + * ... except when PRS=0 and HR=1, or when GTSE=0 for tlbie, + * making it hypervisor privileged. + */ + gen_priv_exception(ctx, POWERPC_EXCP_PRIV_OPC); + return true; + } + } + + if (!local && NARROW_MODE(ctx)) { + TCGv t0 = tcg_temp_new(); + tcg_gen_ext32u_tl(t0, cpu_gpr[rb]); + gen_helper_tlbie(cpu_env, t0); + tcg_temp_free(t0); + } else { + gen_helper_tlbie(cpu_env, cpu_gpr[rb]); + } + + if (local) { + return true; + } + + t1 = tcg_temp_new_i32(); + tcg_gen_ld_i32(t1, cpu_env, offsetof(CPUPPCState, tlb_need_flush)); + tcg_gen_ori_i32(t1, t1, TLB_NEED_GLOBAL_FLUSH); + tcg_gen_st_i32(t1, cpu_env, offsetof(CPUPPCState, tlb_need_flush)); + tcg_temp_free_i32(t1); + + return true; +#endif +} + +TRANS_FLAGS(MEM_TLBIE, TLBIE, do_tlbie, false) +TRANS_FLAGS(MEM_TLBIE, TLBIEL, do_tlbie, true) From patchwork Mon Jul 18 17:21:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657619 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=hPHN3jUU; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lmq4t0fFhz9sFr for ; Tue, 19 Jul 2022 03:41:02 +1000 (AEST) Received: from localhost ([::1]:36446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUjr-0008MV-OM for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:40:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSb-00086c-16; Mon, 18 Jul 2022 13:23:09 -0400 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]:35468) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSN-0001qp-BR; Mon, 18 Jul 2022 13:22:58 -0400 Received: by mail-ot1-x333.google.com with SMTP id g20-20020a9d6a14000000b0061c84e679f5so7041964otn.2; Mon, 18 Jul 2022 10:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EzKSYAoKo0VHtLhkrqz1v8EnVad0CX3bD2N87xVdY3o=; b=hPHN3jUUmiryySIdtgOVM/mpPYSfnXt+yicn2R7Cmf+thWKCVbqavLTC8kfNTp3/1t aJQKQGzIXf7iZQsSR2zb2ghkwfH8rOemaXkyt8APz53fpBbCEvkVVTrKfGUDEK8q4jNp M08bmnF60fwaggDpyUoaHweiGrE7ERbafbcKBGGlVaxQG+Ih6hjYSu+npRbVCQBKME3H eOLcPGWmcGhmNKGEFlQnYBZBvSOAbWVGAKQjWAn5Wp2KyZJKWlUfpD73atJH8xGlaEbZ NbbEt4w7ngwu8/aEBqMu7R6f7dXNC13eOArv3V5I54/wIvTz3ay/1cdZ7ELWtIxUqOqo tCZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EzKSYAoKo0VHtLhkrqz1v8EnVad0CX3bD2N87xVdY3o=; b=VJJn2yStUImJ1OlXrnJMDwgqMQc4JBvw3gTcqnZ0+obuw1dx13BFQJ1E4B6QwVMIMk iYlGCOtXs8wO0/cxyWLr8lWRzxuJxnUwnmn47r53mzBcMYjI2NhCohA7Khjbn4jDw1yM G37dfa+tAnlWbwRwwCZtB8k6enjKLoo3/q8ifZBAyJWkATEPX/mWnFs1AQVcy6RxXj7Y 5GFCtE+A15fBnAjKDd7ZXz2SFvGdq4cFyenLfb+qPmITDo0fD6LRD+I9cZfjtMRIlB2Z o4X05067uK5FKfj1lh55PZ92LPyYvlszFf4YYfcnKgufQwDWaTTQnTxzwd7H7hlosrTy BDTQ== X-Gm-Message-State: AJIora8XulST/oF5oAbQWQirrDHIAFYq+ktQF49cnAtmZiMTvcWVT8VP MKvGLJ85lLyqqNsqxI8xr9GQlrQ+pDM= X-Google-Smtp-Source: AGRyM1tgkpsl+3zqW+QphwdJ7w4egTJQtvNRiiJm1+i3e6wSKl0ydCciO6Rks47V7zVf2i7xhWuqbw== X-Received: by 2002:a05:6830:6388:b0:61c:80a9:d5b6 with SMTP id ch8-20020a056830638800b0061c80a9d5b6mr7861408otb.124.1658164970131; Mon, 18 Jul 2022 10:22:50 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:49 -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, Leandro Lupori Subject: [PULL 15/30] target/ppc: Implement ISA 3.00 tlbie[l] Date: Mon, 18 Jul 2022 14:21:53 -0300 Message-Id: <20220718172208.1247624-16-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x333.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Leandro Lupori This initial version supports the invalidation of one or all TLB entries. Flush by PID/LPID, or based in process/partition scope is not supported, because it would make using the generic QEMU TLB implementation hard. In these cases, all entries are flushed. Signed-off-by: Leandro Lupori Reviewed-by: Daniel Henrique Barboza Message-Id: <20220712193741.59134-3-leandro.lupori@eldorado.org.br> [danielhb: moved 'set' declaration to TLBIE_RIC_PWC block] Signed-off-by: Daniel Henrique Barboza --- target/ppc/helper.h | 2 + target/ppc/mmu-book3s-v3.h | 15 ++ target/ppc/mmu_helper.c | 154 +++++++++++++++++++ target/ppc/translate/storage-ctrl-impl.c.inc | 17 ++ 4 files changed, 188 insertions(+) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 2f112b7de0..294ef1396b 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -674,6 +674,8 @@ DEF_HELPER_FLAGS_1(tlbia, TCG_CALL_NO_RWG, void, env) DEF_HELPER_FLAGS_2(tlbie, TCG_CALL_NO_RWG, void, env, tl) DEF_HELPER_FLAGS_2(tlbiva, TCG_CALL_NO_RWG, void, env, tl) #if defined(TARGET_PPC64) +DEF_HELPER_FLAGS_4(tlbie_isa300, TCG_CALL_NO_WG, void, \ + env, tl, tl, i32) DEF_HELPER_FLAGS_3(store_slb, TCG_CALL_NO_RWG, void, env, tl, tl) DEF_HELPER_2(load_slb_esid, tl, env, tl) DEF_HELPER_2(load_slb_vsid, tl, env, tl) diff --git a/target/ppc/mmu-book3s-v3.h b/target/ppc/mmu-book3s-v3.h index d6d5ed8f8e..674377a19e 100644 --- a/target/ppc/mmu-book3s-v3.h +++ b/target/ppc/mmu-book3s-v3.h @@ -50,6 +50,21 @@ struct prtb_entry { #ifdef TARGET_PPC64 +/* + * tlbie[l] helper flags + * + * RIC, PRS, R and local are passed as flags in the last argument. + */ +#define TLBIE_F_RIC_SHIFT 0 +#define TLBIE_F_PRS_SHIFT 2 +#define TLBIE_F_R_SHIFT 3 +#define TLBIE_F_LOCAL_SHIFT 4 + +#define TLBIE_F_RIC_MASK (3 << TLBIE_F_RIC_SHIFT) +#define TLBIE_F_PRS (1 << TLBIE_F_PRS_SHIFT) +#define TLBIE_F_R (1 << TLBIE_F_R_SHIFT) +#define TLBIE_F_LOCAL (1 << TLBIE_F_LOCAL_SHIFT) + static inline bool ppc64_use_proc_tbl(PowerPCCPU *cpu) { return !!(cpu->env.spr[SPR_LPCR] & LPCR_UPRT); diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c index 15239dc95b..2a91f3f46a 100644 --- a/target/ppc/mmu_helper.c +++ b/target/ppc/mmu_helper.c @@ -429,6 +429,160 @@ void helper_tlbie(CPUPPCState *env, target_ulong addr) ppc_tlb_invalidate_one(env, addr); } +#if defined(TARGET_PPC64) + +/* Invalidation Selector */ +#define TLBIE_IS_VA 0 +#define TLBIE_IS_PID 1 +#define TLBIE_IS_LPID 2 +#define TLBIE_IS_ALL 3 + +/* Radix Invalidation Control */ +#define TLBIE_RIC_TLB 0 +#define TLBIE_RIC_PWC 1 +#define TLBIE_RIC_ALL 2 +#define TLBIE_RIC_GRP 3 + +/* Radix Actual Page sizes */ +#define TLBIE_R_AP_4K 0 +#define TLBIE_R_AP_64K 5 +#define TLBIE_R_AP_2M 1 +#define TLBIE_R_AP_1G 2 + +/* RB field masks */ +#define TLBIE_RB_EPN_MASK PPC_BITMASK(0, 51) +#define TLBIE_RB_IS_MASK PPC_BITMASK(52, 53) +#define TLBIE_RB_AP_MASK PPC_BITMASK(56, 58) + +void helper_tlbie_isa300(CPUPPCState *env, target_ulong rb, target_ulong rs, + uint32_t flags) +{ + unsigned ric = (flags & TLBIE_F_RIC_MASK) >> TLBIE_F_RIC_SHIFT; + /* + * With the exception of the checks for invalid instruction forms, + * PRS is currently ignored, because we don't know if a given TLB entry + * is process or partition scoped. + */ + bool prs = flags & TLBIE_F_PRS; + bool r = flags & TLBIE_F_R; + bool local = flags & TLBIE_F_LOCAL; + bool effR; + unsigned is = extract64(rb, PPC_BIT_NR(53), 2); + unsigned ap; /* actual page size */ + target_ulong addr, pgoffs_mask; + + qemu_log_mask(CPU_LOG_MMU, + "%s: local=%d addr=" TARGET_FMT_lx " ric=%u prs=%d r=%d is=%u\n", + __func__, local, rb & TARGET_PAGE_MASK, ric, prs, r, is); + + effR = FIELD_EX64(env->msr, MSR, HV) ? r : env->spr[SPR_LPCR] & LPCR_HR; + + /* Partial TLB invalidation is supported for Radix only for now. */ + if (!effR) { + goto inval_all; + } + + /* Check for invalid instruction forms (effR=1). */ + if (unlikely(ric == TLBIE_RIC_GRP || + ((ric == TLBIE_RIC_PWC || ric == TLBIE_RIC_ALL) && + is == TLBIE_IS_VA) || + (!prs && is == TLBIE_IS_PID))) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid instruction form: ric=%u prs=%d r=%d is=%u\n", + __func__, ric, prs, r, is); + goto invalid; + } + + /* We don't cache Page Walks. */ + if (ric == TLBIE_RIC_PWC) { + if (local) { + unsigned set = extract64(rb, PPC_BIT_NR(51), 12); + if (set != 0) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid set: %d\n", + __func__, set); + goto invalid; + } + } + return; + } + + /* + * Invalidation by LPID or PID is not supported, so fallback + * to full TLB flush in these cases. + */ + if (is != TLBIE_IS_VA) { + goto inval_all; + } + + /* + * The results of an attempt to invalidate a translation outside of + * quadrant 0 for Radix Tree translation (effR=1, RIC=0, PRS=1, IS=0, + * and EA 0:1 != 0b00) are boundedly undefined. + */ + if (unlikely(ric == TLBIE_RIC_TLB && prs && is == TLBIE_IS_VA && + (rb & R_EADDR_QUADRANT) != R_EADDR_QUADRANT0)) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: attempt to invalidate a translation outside of quadrant 0\n", + __func__); + goto inval_all; + } + + assert(is == TLBIE_IS_VA); + assert(ric == TLBIE_RIC_TLB || ric == TLBIE_RIC_ALL); + + ap = extract64(rb, PPC_BIT_NR(58), 3); + switch (ap) { + case TLBIE_R_AP_4K: + pgoffs_mask = 0xfffull; + break; + + case TLBIE_R_AP_64K: + pgoffs_mask = 0xffffull; + break; + + case TLBIE_R_AP_2M: + pgoffs_mask = 0x1fffffull; + break; + + case TLBIE_R_AP_1G: + pgoffs_mask = 0x3fffffffull; + break; + + default: + /* + * If the value specified in RS 0:31, RS 32:63, RB 54:55, RB 56:58, + * RB 44:51, or RB 56:63, when it is needed to perform the specified + * operation, is not supported by the implementation, the instruction + * is treated as if the instruction form were invalid. + */ + qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid AP: %d\n", __func__, ap); + goto invalid; + } + + addr = rb & TLBIE_RB_EPN_MASK & ~pgoffs_mask; + + if (local) { + tlb_flush_page(env_cpu(env), addr); + } else { + tlb_flush_page_all_cpus(env_cpu(env), addr); + } + return; + +inval_all: + env->tlb_need_flush |= TLB_NEED_LOCAL_FLUSH; + if (!local) { + env->tlb_need_flush |= TLB_NEED_GLOBAL_FLUSH; + } + return; + +invalid: + raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM, + POWERPC_EXCP_INVAL | + POWERPC_EXCP_INVAL_INVAL, GETPC()); +} + +#endif + void helper_tlbiva(CPUPPCState *env, target_ulong addr) { /* tlbiva instruction only exists on BookE */ diff --git a/target/ppc/translate/storage-ctrl-impl.c.inc b/target/ppc/translate/storage-ctrl-impl.c.inc index 7793297dd4..467c390888 100644 --- a/target/ppc/translate/storage-ctrl-impl.c.inc +++ b/target/ppc/translate/storage-ctrl-impl.c.inc @@ -21,6 +21,8 @@ * Store Control Instructions */ +#include "mmu-book3s-v3.h" + static bool do_tlbie(DisasContext *ctx, arg_X_tlbie *a, bool local) { #if defined(CONFIG_USER_ONLY) @@ -65,6 +67,21 @@ static bool do_tlbie(DisasContext *ctx, arg_X_tlbie *a, bool local) tcg_gen_ext32u_tl(t0, cpu_gpr[rb]); gen_helper_tlbie(cpu_env, t0); tcg_temp_free(t0); + +#if defined(TARGET_PPC64) + /* + * ISA 3.1B says that MSR SF must be 1 when this instruction is executed; + * otherwise the results are undefined. + */ + } else if (a->r) { + gen_helper_tlbie_isa300(cpu_env, cpu_gpr[rb], cpu_gpr[a->rs], + tcg_constant_i32(a->ric << TLBIE_F_RIC_SHIFT | + a->prs << TLBIE_F_PRS_SHIFT | + a->r << TLBIE_F_R_SHIFT | + local << TLBIE_F_LOCAL_SHIFT)); + return true; +#endif + } else { gen_helper_tlbie(cpu_env, cpu_gpr[rb]); } From patchwork Mon Jul 18 17:21:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657598 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=HpgA6T9m; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LmpqF6TJXz9sFr for ; Tue, 19 Jul 2022 03:29:13 +1000 (AEST) Received: from localhost ([::1]:37750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUYR-0005y5-P0 for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:29:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSb-00087A-2Q; Mon, 18 Jul 2022 13:23:09 -0400 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]:34341) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSN-0001qw-5I; Mon, 18 Jul 2022 13:22:58 -0400 Received: by mail-ot1-x32a.google.com with SMTP id g19-20020a9d1293000000b0061c7bfda5dfso9360729otg.1; Mon, 18 Jul 2022 10:22:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=A2ZUp18kHaispg3o+cwDM4BMmMxGy5ZvnLwq0jJFNFA=; b=HpgA6T9m5m3dDAKwbiHSWjii8a0AP1/S1lMaXCZKF5+8wuoRGsTE8FMczQlnizTE8b +vtMOPj5bvSDQIEbpo+vWxz0gsFXpXqdzOKnd8asDq2uHPXpeRItM9Dk83Gop4WSFPsd +AG2GrdEPSVWOjCVYTxYcr+WigQMWAquQiD0KItNE5KHg5Kc/EEDXQLY42gnoywnptlQ YHJ+SMRcGFq1wDy69wmhoRgVE3ZDELsazBlsUkEgHho1Qz/7IEw0KlEe6eS/kmJ2R/wD 7rdloTHnL5lSGrQ+Iw7CfRjq1m6GCQNHBUefbJNjqFAcBOKYX2R5RLtmdlWeLVVo6bbd IGjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A2ZUp18kHaispg3o+cwDM4BMmMxGy5ZvnLwq0jJFNFA=; b=UYez/chvw4wRbbMk7K1nS6ayCvzCxhP7NPxK5zjlPtGtkLXaV62IfQhnjyJ3ASAwzh qTWV+NpH7UwSof3Jh/VLz11ftXTKOANINd2DaTIFRnIkntFvs/uo4mFT8g/L23TJsIJJ GWuLGmXHz5IRLIGl7cRNfjwL9MtmK1bbYsfAbI4SFV9UhC0IktHm5CfO7DTRhSMqKYBe hJmw2g/dolntYEjfUKyTS9GgUtOxN//DtropWRVdgTmXrH/n8CC+t3zGlYoTarmkGNRY QfYVX724yS0bqvCO5umX4pDax6zApKl6BUZq+GyHnUCOoOjuSPQEoYlTwIf09A1saJG9 H9QQ== X-Gm-Message-State: AJIora+BuqCSInjmwpgKF+9BK6N13V4LnZV1mbCtbgaeNx+qWOkUfyFS ANQnDQ94uLSKMRpeTve8c2kfnC83Di8= X-Google-Smtp-Source: AGRyM1svUFgqaKPJXuXBctWsXuXNctJaE4f0B75xEhPlW3OQkb9sCbcecYbIRTElL+LqyszxzF5o7Q== X-Received: by 2002:a9d:761a:0:b0:60b:6c4d:414e with SMTP id k26-20020a9d761a000000b0060b6c4d414emr11299033otl.25.1658164972926; Mon, 18 Jul 2022 10:22:52 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:52 -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, Matheus Ferst , Leandro Lupori Subject: [PULL 16/30] target/ppc: receive DisasContext explicitly in GEN_PRIV Date: Mon, 18 Jul 2022 14:21:54 -0300 Message-Id: <20220718172208.1247624-17-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32a; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x32a.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Matheus Ferst GEN_PRIV and related CHK_* macros just assumed that variable named "ctx" would be in scope when they are used, and that it would be a pointer to DisasContext. Change these macros to receive the pointer explicitly. Reviewed-by: Leandro Lupori Signed-off-by: Matheus Ferst Signed-off-by: Lucas Coutinho Message-Id: <20220701133507.740619-2-lucas.coutinho@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/translate.c | 299 +++++++++++++++-------------- target/ppc/translate/fp-impl.c.inc | 4 +- 2 files changed, 154 insertions(+), 149 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 440ec8a700..8afc2e4691 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -1267,38 +1267,43 @@ typedef struct opcode_t { const char *oname; } opcode_t; +static void gen_priv_opc(DisasContext *ctx) +{ + gen_priv_exception(ctx, POWERPC_EXCP_PRIV_OPC); +} + /* Helpers for priv. check */ -#define GEN_PRIV \ - do { \ - gen_priv_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; \ +#define GEN_PRIV(CTX) \ + do { \ + gen_priv_opc(CTX); return; \ } while (0) #if defined(CONFIG_USER_ONLY) -#define CHK_HV GEN_PRIV -#define CHK_SV GEN_PRIV -#define CHK_HVRM GEN_PRIV +#define CHK_HV(CTX) GEN_PRIV(CTX) +#define CHK_SV(CTX) GEN_PRIV(CTX) +#define CHK_HVRM(CTX) GEN_PRIV(CTX) #else -#define CHK_HV \ - do { \ - if (unlikely(ctx->pr || !ctx->hv)) { \ - GEN_PRIV; \ - } \ +#define CHK_HV(CTX) \ + do { \ + if (unlikely(ctx->pr || !ctx->hv)) {\ + GEN_PRIV(CTX); \ + } \ } while (0) -#define CHK_SV \ +#define CHK_SV(CTX) \ do { \ if (unlikely(ctx->pr)) { \ - GEN_PRIV; \ + GEN_PRIV(CTX); \ } \ } while (0) -#define CHK_HVRM \ - do { \ - if (unlikely(ctx->pr || !ctx->hv || ctx->dr)) { \ - GEN_PRIV; \ - } \ +#define CHK_HVRM(CTX) \ + do { \ + if (unlikely(ctx->pr || !ctx->hv || ctx->dr)) { \ + GEN_PRIV(CTX); \ + } \ } while (0) #endif -#define CHK_NONE +#define CHK_NONE(CTX) /*****************************************************************************/ /* PowerPC instructions table */ @@ -3252,7 +3257,7 @@ GEN_QEMU_STORE_64(st64r, BSWAP_MEMOP(MO_UQ)) static void glue(gen_, name##x)(DisasContext *ctx) \ { \ TCGv EA; \ - chk; \ + chk(ctx); \ gen_set_access_type(ctx, ACCESS_INT); \ EA = tcg_temp_new(); \ gen_addr_reg_index(ctx, EA); \ @@ -3270,7 +3275,7 @@ static void glue(gen_, name##x)(DisasContext *ctx) \ static void glue(gen_, name##epx)(DisasContext *ctx) \ { \ TCGv EA; \ - CHK_SV; \ + CHK_SV(ctx); \ gen_set_access_type(ctx, ACCESS_INT); \ EA = tcg_temp_new(); \ gen_addr_reg_index(ctx, EA); \ @@ -3298,7 +3303,7 @@ GEN_LDX_HVRM(lbzcix, ld8u, 0x15, 0x1a, PPC_CILDST) static void glue(gen_, name##x)(DisasContext *ctx) \ { \ TCGv EA; \ - chk; \ + chk(ctx); \ gen_set_access_type(ctx, ACCESS_INT); \ EA = tcg_temp_new(); \ gen_addr_reg_index(ctx, EA); \ @@ -3315,7 +3320,7 @@ static void glue(gen_, name##x)(DisasContext *ctx) \ static void glue(gen_, name##epx)(DisasContext *ctx) \ { \ TCGv EA; \ - CHK_SV; \ + CHK_SV(ctx); \ gen_set_access_type(ctx, ACCESS_INT); \ EA = tcg_temp_new(); \ gen_addr_reg_index(ctx, EA); \ @@ -4078,11 +4083,11 @@ static void gen_wait(DisasContext *ctx) static void gen_doze(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv_i32 t; - CHK_HV; + CHK_HV(ctx); t = tcg_const_i32(PPC_PM_DOZE); gen_helper_pminsn(cpu_env, t); tcg_temp_free_i32(t); @@ -4094,11 +4099,11 @@ static void gen_doze(DisasContext *ctx) static void gen_nap(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv_i32 t; - CHK_HV; + CHK_HV(ctx); t = tcg_const_i32(PPC_PM_NAP); gen_helper_pminsn(cpu_env, t); tcg_temp_free_i32(t); @@ -4110,11 +4115,11 @@ static void gen_nap(DisasContext *ctx) static void gen_stop(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv_i32 t; - CHK_HV; + CHK_HV(ctx); t = tcg_const_i32(PPC_PM_STOP); gen_helper_pminsn(cpu_env, t); tcg_temp_free_i32(t); @@ -4126,11 +4131,11 @@ static void gen_stop(DisasContext *ctx) static void gen_sleep(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv_i32 t; - CHK_HV; + CHK_HV(ctx); t = tcg_const_i32(PPC_PM_SLEEP); gen_helper_pminsn(cpu_env, t); tcg_temp_free_i32(t); @@ -4142,11 +4147,11 @@ static void gen_sleep(DisasContext *ctx) static void gen_rvwinkle(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv_i32 t; - CHK_HV; + CHK_HV(ctx); t = tcg_const_i32(PPC_PM_RVWINKLE); gen_helper_pminsn(cpu_env, t); tcg_temp_free_i32(t); @@ -4476,7 +4481,7 @@ static void gen_mcrf(DisasContext *ctx) static void gen_rfi(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else /* * This instruction doesn't exist anymore on 64-bit server @@ -4487,7 +4492,7 @@ static void gen_rfi(DisasContext *ctx) return; } /* Restore CPU state */ - CHK_SV; + CHK_SV(ctx); gen_icount_io_start(ctx); gen_update_cfar(ctx, ctx->cia); gen_helper_rfi(cpu_env); @@ -4499,10 +4504,10 @@ static void gen_rfi(DisasContext *ctx) static void gen_rfid(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else /* Restore CPU state */ - CHK_SV; + CHK_SV(ctx); gen_icount_io_start(ctx); gen_update_cfar(ctx, ctx->cia); gen_helper_rfid(cpu_env); @@ -4514,10 +4519,10 @@ static void gen_rfid(DisasContext *ctx) static void gen_rfscv(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else /* Restore CPU state */ - CHK_SV; + CHK_SV(ctx); gen_icount_io_start(ctx); gen_update_cfar(ctx, ctx->cia); gen_helper_rfscv(cpu_env); @@ -4529,10 +4534,10 @@ static void gen_rfscv(DisasContext *ctx) static void gen_hrfid(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else /* Restore CPU state */ - CHK_HV; + CHK_HV(ctx); gen_helper_hrfid(cpu_env); ctx->base.is_jmp = DISAS_EXIT; #endif @@ -4733,7 +4738,7 @@ static void gen_mfcr(DisasContext *ctx) /* mfmsr */ static void gen_mfmsr(DisasContext *ctx) { - CHK_SV; + CHK_SV(ctx); tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_msr); } @@ -4847,7 +4852,7 @@ static void gen_mtmsrd(DisasContext *ctx) return; } - CHK_SV; + CHK_SV(ctx); #if !defined(CONFIG_USER_ONLY) TCGv t0, t1; @@ -4890,7 +4895,7 @@ static void gen_mtmsrd(DisasContext *ctx) static void gen_mtmsr(DisasContext *ctx) { - CHK_SV; + CHK_SV(ctx); #if !defined(CONFIG_USER_ONLY) TCGv t0, t1; @@ -5022,7 +5027,7 @@ static void gen_dcbfep(DisasContext *ctx) { /* XXX: specification says this is treated as a load by the MMU */ TCGv t0; - CHK_SV; + CHK_SV(ctx); gen_set_access_type(ctx, ACCESS_CACHE); t0 = tcg_temp_new(); gen_addr_reg_index(ctx, t0); @@ -5034,11 +5039,11 @@ static void gen_dcbfep(DisasContext *ctx) static void gen_dcbi(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv EA, val; - CHK_SV; + CHK_SV(ctx); EA = tcg_temp_new(); gen_set_access_type(ctx, ACCESS_CACHE); gen_addr_reg_index(ctx, EA); @@ -5223,11 +5228,11 @@ static void gen_dcba(DisasContext *ctx) static void gen_mfsr(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv t0; - CHK_SV; + CHK_SV(ctx); t0 = tcg_const_tl(SR(ctx->opcode)); gen_helper_load_sr(cpu_gpr[rD(ctx->opcode)], cpu_env, t0); tcg_temp_free(t0); @@ -5238,11 +5243,11 @@ static void gen_mfsr(DisasContext *ctx) static void gen_mfsrin(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv t0; - CHK_SV; + CHK_SV(ctx); t0 = tcg_temp_new(); tcg_gen_extract_tl(t0, cpu_gpr[rB(ctx->opcode)], 28, 4); gen_helper_load_sr(cpu_gpr[rD(ctx->opcode)], cpu_env, t0); @@ -5254,11 +5259,11 @@ static void gen_mfsrin(DisasContext *ctx) static void gen_mtsr(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv t0; - CHK_SV; + CHK_SV(ctx); t0 = tcg_const_tl(SR(ctx->opcode)); gen_helper_store_sr(cpu_env, t0, cpu_gpr[rS(ctx->opcode)]); tcg_temp_free(t0); @@ -5269,10 +5274,10 @@ static void gen_mtsr(DisasContext *ctx) static void gen_mtsrin(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv t0; - CHK_SV; + CHK_SV(ctx); t0 = tcg_temp_new(); tcg_gen_extract_tl(t0, cpu_gpr[rB(ctx->opcode)], 28, 4); @@ -5288,11 +5293,11 @@ static void gen_mtsrin(DisasContext *ctx) static void gen_mfsr_64b(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv t0; - CHK_SV; + CHK_SV(ctx); t0 = tcg_const_tl(SR(ctx->opcode)); gen_helper_load_sr(cpu_gpr[rD(ctx->opcode)], cpu_env, t0); tcg_temp_free(t0); @@ -5303,11 +5308,11 @@ static void gen_mfsr_64b(DisasContext *ctx) static void gen_mfsrin_64b(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv t0; - CHK_SV; + CHK_SV(ctx); t0 = tcg_temp_new(); tcg_gen_extract_tl(t0, cpu_gpr[rB(ctx->opcode)], 28, 4); gen_helper_load_sr(cpu_gpr[rD(ctx->opcode)], cpu_env, t0); @@ -5319,11 +5324,11 @@ static void gen_mfsrin_64b(DisasContext *ctx) static void gen_mtsr_64b(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv t0; - CHK_SV; + CHK_SV(ctx); t0 = tcg_const_tl(SR(ctx->opcode)); gen_helper_store_sr(cpu_env, t0, cpu_gpr[rS(ctx->opcode)]); tcg_temp_free(t0); @@ -5334,11 +5339,11 @@ static void gen_mtsr_64b(DisasContext *ctx) static void gen_mtsrin_64b(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv t0; - CHK_SV; + CHK_SV(ctx); t0 = tcg_temp_new(); tcg_gen_extract_tl(t0, cpu_gpr[rB(ctx->opcode)], 28, 4); gen_helper_store_sr(cpu_env, t0, cpu_gpr[rS(ctx->opcode)]); @@ -5350,9 +5355,9 @@ static void gen_mtsrin_64b(DisasContext *ctx) static void gen_slbmte(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); gen_helper_store_slb(cpu_env, cpu_gpr[rB(ctx->opcode)], cpu_gpr[rS(ctx->opcode)]); @@ -5362,9 +5367,9 @@ static void gen_slbmte(DisasContext *ctx) static void gen_slbmfee(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); gen_helper_load_slb_esid(cpu_gpr[rS(ctx->opcode)], cpu_env, cpu_gpr[rB(ctx->opcode)]); @@ -5374,9 +5379,9 @@ static void gen_slbmfee(DisasContext *ctx) static void gen_slbmfev(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); gen_helper_load_slb_vsid(cpu_gpr[rS(ctx->opcode)], cpu_env, cpu_gpr[rB(ctx->opcode)]); @@ -5416,9 +5421,9 @@ static void gen_slbfee_(DisasContext *ctx) static void gen_tlbia(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_HV; + CHK_HV(ctx); gen_helper_tlbia(cpu_env); #endif /* defined(CONFIG_USER_ONLY) */ @@ -5428,13 +5433,13 @@ static void gen_tlbia(DisasContext *ctx) static void gen_tlbsync(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else if (ctx->gtse) { - CHK_SV; /* If gtse is set then tlbsync is supervisor privileged */ + CHK_SV(ctx); /* If gtse is set then tlbsync is supervisor privileged */ } else { - CHK_HV; /* Else hypervisor privileged */ + CHK_HV(ctx); /* Else hypervisor privileged */ } /* BookS does both ptesync and tlbsync make tlbsync a nop for server */ @@ -5449,12 +5454,12 @@ static void gen_tlbsync(DisasContext *ctx) static void gen_slbia(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else uint32_t ih = (ctx->opcode >> 21) & 0x7; TCGv_i32 t0 = tcg_const_i32(ih); - CHK_SV; + CHK_SV(ctx); gen_helper_slbia(cpu_env, t0); tcg_temp_free_i32(t0); @@ -5465,9 +5470,9 @@ static void gen_slbia(DisasContext *ctx) static void gen_slbie(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); gen_helper_slbie(cpu_env, cpu_gpr[rB(ctx->opcode)]); #endif /* defined(CONFIG_USER_ONLY) */ @@ -5477,9 +5482,9 @@ static void gen_slbie(DisasContext *ctx) static void gen_slbieg(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); gen_helper_slbieg(cpu_env, cpu_gpr[rB(ctx->opcode)]); #endif /* defined(CONFIG_USER_ONLY) */ @@ -5489,9 +5494,9 @@ static void gen_slbieg(DisasContext *ctx) static void gen_slbsync(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); gen_check_tlb_flush(ctx, true); #endif /* defined(CONFIG_USER_ONLY) */ } @@ -5533,9 +5538,9 @@ static void gen_ecowx(DisasContext *ctx) static void gen_tlbld_6xx(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); gen_helper_6xx_tlbd(cpu_env, cpu_gpr[rB(ctx->opcode)]); #endif /* defined(CONFIG_USER_ONLY) */ } @@ -5544,9 +5549,9 @@ static void gen_tlbld_6xx(DisasContext *ctx) static void gen_tlbli_6xx(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); gen_helper_6xx_tlbi(cpu_env, cpu_gpr[rB(ctx->opcode)]); #endif /* defined(CONFIG_USER_ONLY) */ } @@ -5564,11 +5569,11 @@ static void gen_mfapidi(DisasContext *ctx) static void gen_tlbiva(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv t0; - CHK_SV; + CHK_SV(ctx); t0 = tcg_temp_new(); gen_addr_reg_index(ctx, t0); gen_helper_tlbiva(cpu_env, cpu_gpr[rB(ctx->opcode)]); @@ -5795,11 +5800,11 @@ GEN_MAC_HANDLER(mullhwu, 0x08, 0x0C); static void gen_mfdcr(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv dcrn; - CHK_SV; + CHK_SV(ctx); dcrn = tcg_const_tl(SPR(ctx->opcode)); gen_helper_load_dcr(cpu_gpr[rD(ctx->opcode)], cpu_env, dcrn); tcg_temp_free(dcrn); @@ -5810,11 +5815,11 @@ static void gen_mfdcr(DisasContext *ctx) static void gen_mtdcr(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv dcrn; - CHK_SV; + CHK_SV(ctx); dcrn = tcg_const_tl(SPR(ctx->opcode)); gen_helper_store_dcr(cpu_env, dcrn, cpu_gpr[rS(ctx->opcode)]); tcg_temp_free(dcrn); @@ -5826,9 +5831,9 @@ static void gen_mtdcr(DisasContext *ctx) static void gen_mfdcrx(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); gen_helper_load_dcr(cpu_gpr[rD(ctx->opcode)], cpu_env, cpu_gpr[rA(ctx->opcode)]); /* Note: Rc update flag set leads to undefined state of Rc0 */ @@ -5840,9 +5845,9 @@ static void gen_mfdcrx(DisasContext *ctx) static void gen_mtdcrx(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); gen_helper_store_dcr(cpu_env, cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)]); /* Note: Rc update flag set leads to undefined state of Rc0 */ @@ -5852,7 +5857,7 @@ static void gen_mtdcrx(DisasContext *ctx) /* dccci */ static void gen_dccci(DisasContext *ctx) { - CHK_SV; + CHK_SV(ctx); /* interpreted as no-op */ } @@ -5860,11 +5865,11 @@ static void gen_dccci(DisasContext *ctx) static void gen_dcread(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv EA, val; - CHK_SV; + CHK_SV(ctx); gen_set_access_type(ctx, ACCESS_CACHE); EA = tcg_temp_new(); gen_addr_reg_index(ctx, EA); @@ -5889,14 +5894,14 @@ static void gen_icbt_40x(DisasContext *ctx) /* iccci */ static void gen_iccci(DisasContext *ctx) { - CHK_SV; + CHK_SV(ctx); /* interpreted as no-op */ } /* icread */ static void gen_icread(DisasContext *ctx) { - CHK_SV; + CHK_SV(ctx); /* interpreted as no-op */ } @@ -5904,9 +5909,9 @@ static void gen_icread(DisasContext *ctx) static void gen_rfci_40x(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); /* Restore CPU state */ gen_helper_40x_rfci(cpu_env); ctx->base.is_jmp = DISAS_EXIT; @@ -5916,9 +5921,9 @@ static void gen_rfci_40x(DisasContext *ctx) static void gen_rfci(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); /* Restore CPU state */ gen_helper_rfci(cpu_env); ctx->base.is_jmp = DISAS_EXIT; @@ -5931,9 +5936,9 @@ static void gen_rfci(DisasContext *ctx) static void gen_rfdi(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); /* Restore CPU state */ gen_helper_rfdi(cpu_env); ctx->base.is_jmp = DISAS_EXIT; @@ -5944,9 +5949,9 @@ static void gen_rfdi(DisasContext *ctx) static void gen_rfmci(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); /* Restore CPU state */ gen_helper_rfmci(cpu_env); ctx->base.is_jmp = DISAS_EXIT; @@ -5959,9 +5964,9 @@ static void gen_rfmci(DisasContext *ctx) static void gen_tlbre_40x(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); switch (rB(ctx->opcode)) { case 0: gen_helper_4xx_tlbre_hi(cpu_gpr[rD(ctx->opcode)], cpu_env, @@ -5982,11 +5987,11 @@ static void gen_tlbre_40x(DisasContext *ctx) static void gen_tlbsx_40x(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv t0; - CHK_SV; + CHK_SV(ctx); t0 = tcg_temp_new(); gen_addr_reg_index(ctx, t0); gen_helper_4xx_tlbsx(cpu_gpr[rD(ctx->opcode)], cpu_env, t0); @@ -6005,9 +6010,9 @@ static void gen_tlbsx_40x(DisasContext *ctx) static void gen_tlbwe_40x(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); switch (rB(ctx->opcode)) { case 0: @@ -6031,9 +6036,9 @@ static void gen_tlbwe_40x(DisasContext *ctx) static void gen_tlbre_440(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); switch (rB(ctx->opcode)) { case 0: @@ -6057,11 +6062,11 @@ static void gen_tlbre_440(DisasContext *ctx) static void gen_tlbsx_440(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv t0; - CHK_SV; + CHK_SV(ctx); t0 = tcg_temp_new(); gen_addr_reg_index(ctx, t0); gen_helper_440_tlbsx(cpu_gpr[rD(ctx->opcode)], cpu_env, t0); @@ -6080,9 +6085,9 @@ static void gen_tlbsx_440(DisasContext *ctx) static void gen_tlbwe_440(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); switch (rB(ctx->opcode)) { case 0: case 1: @@ -6107,9 +6112,9 @@ static void gen_tlbwe_440(DisasContext *ctx) static void gen_tlbre_booke206(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); gen_helper_booke206_tlbre(cpu_env); #endif /* defined(CONFIG_USER_ONLY) */ } @@ -6118,11 +6123,11 @@ static void gen_tlbre_booke206(DisasContext *ctx) static void gen_tlbsx_booke206(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv t0; - CHK_SV; + CHK_SV(ctx); if (rA(ctx->opcode)) { t0 = tcg_temp_new(); tcg_gen_mov_tl(t0, cpu_gpr[rD(ctx->opcode)]); @@ -6140,9 +6145,9 @@ static void gen_tlbsx_booke206(DisasContext *ctx) static void gen_tlbwe_booke206(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); gen_helper_booke206_tlbwe(cpu_env); #endif /* defined(CONFIG_USER_ONLY) */ } @@ -6150,11 +6155,11 @@ static void gen_tlbwe_booke206(DisasContext *ctx) static void gen_tlbivax_booke206(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv t0; - CHK_SV; + CHK_SV(ctx); t0 = tcg_temp_new(); gen_addr_reg_index(ctx, t0); gen_helper_booke206_tlbivax(cpu_env, t0); @@ -6165,11 +6170,11 @@ static void gen_tlbivax_booke206(DisasContext *ctx) static void gen_tlbilx_booke206(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv t0; - CHK_SV; + CHK_SV(ctx); t0 = tcg_temp_new(); gen_addr_reg_index(ctx, t0); @@ -6197,11 +6202,11 @@ static void gen_tlbilx_booke206(DisasContext *ctx) static void gen_wrtee(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else TCGv t0; - CHK_SV; + CHK_SV(ctx); t0 = tcg_temp_new(); tcg_gen_andi_tl(t0, cpu_gpr[rD(ctx->opcode)], (1 << MSR_EE)); tcg_gen_andi_tl(cpu_msr, cpu_msr, ~(1 << MSR_EE)); @@ -6219,9 +6224,9 @@ static void gen_wrtee(DisasContext *ctx) static void gen_wrteei(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); if (ctx->opcode & 0x00008000) { tcg_gen_ori_tl(cpu_msr, cpu_msr, (1 << MSR_EE)); /* Stop translation to have a chance to raise an exception */ @@ -6275,9 +6280,9 @@ static void gen_icbt_440(DisasContext *ctx) static void gen_msgclr(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_HV; + CHK_HV(ctx); if (is_book3s_arch2x(ctx)) { gen_helper_book3s_msgclr(cpu_env, cpu_gpr[rB(ctx->opcode)]); } else { @@ -6289,9 +6294,9 @@ static void gen_msgclr(DisasContext *ctx) static void gen_msgsnd(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_HV; + CHK_HV(ctx); if (is_book3s_arch2x(ctx)) { gen_helper_book3s_msgsnd(cpu_gpr[rB(ctx->opcode)]); } else { @@ -6304,9 +6309,9 @@ static void gen_msgsnd(DisasContext *ctx) static void gen_msgclrp(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); gen_helper_book3s_msgclrp(cpu_env, cpu_gpr[rB(ctx->opcode)]); #endif /* defined(CONFIG_USER_ONLY) */ } @@ -6314,9 +6319,9 @@ static void gen_msgclrp(DisasContext *ctx) static void gen_msgsndp(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_SV; + CHK_SV(ctx); gen_helper_book3s_msgsndp(cpu_env, cpu_gpr[rB(ctx->opcode)]); #endif /* defined(CONFIG_USER_ONLY) */ } @@ -6325,9 +6330,9 @@ static void gen_msgsndp(DisasContext *ctx) static void gen_msgsync(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) - GEN_PRIV; + GEN_PRIV(ctx); #else - CHK_HV; + CHK_HV(ctx); #endif /* defined(CONFIG_USER_ONLY) */ /* interpreted as no-op */ } @@ -6438,7 +6443,7 @@ static void gen_tcheck(DisasContext *ctx) #define GEN_TM_PRIV_NOOP(name) \ static inline void gen_##name(DisasContext *ctx) \ { \ - gen_priv_exception(ctx, POWERPC_EXCP_PRIV_OPC); \ + gen_priv_opc(ctx); \ } #else @@ -6446,7 +6451,7 @@ static inline void gen_##name(DisasContext *ctx) \ #define GEN_TM_PRIV_NOOP(name) \ static inline void gen_##name(DisasContext *ctx) \ { \ - CHK_SV; \ + CHK_SV(ctx); \ if (unlikely(!ctx->tm_enabled)) { \ gen_exception_err(ctx, POWERPC_EXCP_FU, FSCR_IC_TM); \ return; \ diff --git a/target/ppc/translate/fp-impl.c.inc b/target/ppc/translate/fp-impl.c.inc index 319513d001..0e893eafa7 100644 --- a/target/ppc/translate/fp-impl.c.inc +++ b/target/ppc/translate/fp-impl.c.inc @@ -901,7 +901,7 @@ static void gen_lfdepx(DisasContext *ctx) { TCGv EA; TCGv_i64 t0; - CHK_SV; + CHK_SV(ctx); if (unlikely(!ctx->fpu_enabled)) { gen_exception(ctx, POWERPC_EXCP_FPU); return; @@ -1058,7 +1058,7 @@ static void gen_stfdepx(DisasContext *ctx) { TCGv EA; TCGv_i64 t0; - CHK_SV; + CHK_SV(ctx); if (unlikely(!ctx->fpu_enabled)) { gen_exception(ctx, POWERPC_EXCP_FPU); return; From patchwork Mon Jul 18 17:21:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657626 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=EMV1en0l; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LmqDS2Rh6z9sFr for ; Tue, 19 Jul 2022 03:47:36 +1000 (AEST) Received: from localhost ([::1]:45838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUqE-0007Hs-5Z for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:47:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43632) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSc-0008BB-82; Mon, 18 Jul 2022 13:23:10 -0400 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]:43704) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSa-0001rD-Hx; Mon, 18 Jul 2022 13:23:09 -0400 Received: by mail-ot1-x32c.google.com with SMTP id k8-20020a9d4b88000000b0061c7f8c4f77so8763293otf.10; Mon, 18 Jul 2022 10:22:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uVfFFENSSuChvjRjR1F/q00A7ZvGxHAMTSPIY1zM1HM=; b=EMV1en0lmpMfSdEjxIqQUbxoxWJmv752G9ubWCSUETCvH4i6m5gY8yXkkHXNfKKHEP IUXHsITctvdPqlZvfH2gJRgrnoGAkPDEinD8Y13PqgPrHmKcOFoOFZKCGz1zjGtkF61G vxvieElh9bFtYYaHUCTWsDhg/Of5xiJmkQHwQzEyBLt46KJf0moSqvsP4uX/BSagVjns 6ehCBozsScfogmHSRMGxHKs8cwDu4hhzXePfshG5V22t81By0wMzRKiDG9mzMHWyDH0a Vxu7zdefAeo6EOtSkGyLqAhnSqhl4r4up02M7AC6K0+OiOQW7B/kRWODttUkkEI1p9NR YReQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uVfFFENSSuChvjRjR1F/q00A7ZvGxHAMTSPIY1zM1HM=; b=mjmqRcb+ECnY505764TzxjYRUxQ7na+LuAUGbV+NY1ZF/x2ItC/RUc1W4Kqp+HMmLu b8SPQMuWgHVdu7ZUVbd0ID2Mc0Ek+Njgtp0fylXDfeIMY6GzhiWJGAn2oO11E2Em7gn7 mjNz+7I9LZvuzZ7G5ded44FxS7vlGNHvgnqEZwAIvnueiCibADzDX639jDfI6H+aR5cV Q00FP/xVAXthFqUgY97HWB5k5aZY9Dtsf6amVjmHzlusZDeTCv63IkeoX7wr2pSErbJg hFTno8jePJIjnvCzt2yJx1pPCmvfsGbRm41gktkmPu74qCrdEhPGmqCXdQBiZT6pVil4 FdwA== X-Gm-Message-State: AJIora+B+CIBEUhIn4+72VUNoCgEewb2kOoW4Jwcvl2WBy6s2gnlu5jg TDTXS5BggM+vsMxUFIG3dRwl7S+4mmc= X-Google-Smtp-Source: AGRyM1ug6TQ6TqMHqrOy62je5PZ4LpYnrBNX8f6aE5y/cblPZTKb2xKcEm7ajkoVlSVuNXroe/L84g== X-Received: by 2002:a05:6830:268f:b0:617:6a7:185f with SMTP id l15-20020a056830268f00b0061706a7185fmr11295125otu.344.1658164975442; Mon, 18 Jul 2022 10:22:55 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:54 -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, Matheus Ferst , Leandro Lupori Subject: [PULL 17/30] target/ppc: add macros to check privilege level Date: Mon, 18 Jul 2022 14:21:55 -0300 Message-Id: <20220718172208.1247624-18-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32c; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x32c.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Matheus Ferst Equivalent to CHK_SV and CHK_HV, but can be used in decodetree methods. Reviewed-by: Leandro Lupori Signed-off-by: Matheus Ferst Signed-off-by: Lucas Coutinho Message-Id: <20220701133507.740619-3-lucas.coutinho@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/translate.c | 21 +++++++++++++++++++++ target/ppc/translate/fixedpoint-impl.c.inc | 7 ++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 8afc2e4691..e373c39fc8 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -6559,6 +6559,27 @@ static int times_16(DisasContext *ctx, int x) } \ } while (0) +#if !defined(CONFIG_USER_ONLY) +#define REQUIRE_SV(CTX) \ + do { \ + if (unlikely((CTX)->pr)) { \ + gen_priv_opc(CTX); \ + return true; \ + } \ + } while (0) + +#define REQUIRE_HV(CTX) \ + do { \ + if (unlikely((CTX)->pr || !(CTX)->hv)) \ + gen_priv_opc(CTX); \ + return true; \ + } \ + } while (0) +#else +#define REQUIRE_SV(CTX) do { gen_priv_opc(CTX); return true; } while (0) +#define REQUIRE_HV(CTX) do { gen_priv_opc(CTX); return true; } while (0) +#endif + /* * Helpers for implementing sets of trans_* functions. * Defer the implementation of NAME to FUNC, with optional extra arguments. diff --git a/target/ppc/translate/fixedpoint-impl.c.inc b/target/ppc/translate/fixedpoint-impl.c.inc index cb0097bedb..db14d3bebc 100644 --- a/target/ppc/translate/fixedpoint-impl.c.inc +++ b/target/ppc/translate/fixedpoint-impl.c.inc @@ -79,11 +79,8 @@ static bool do_ldst_quad(DisasContext *ctx, arg_D *a, bool store, bool prefixed) REQUIRE_INSNS_FLAGS(ctx, 64BX); if (!prefixed && !(ctx->insns_flags2 & PPC2_LSQ_ISA207)) { - if (ctx->pr) { - /* lq and stq were privileged prior to V. 2.07 */ - gen_priv_exception(ctx, POWERPC_EXCP_PRIV_OPC); - return true; - } + /* lq and stq were privileged prior to V. 2.07 */ + REQUIRE_SV(ctx); if (ctx->le_mode) { gen_align_no_le(ctx); From patchwork Mon Jul 18 17:21:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657605 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Fdh8RRC0; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lmpvc0BMsz9sFr for ; Tue, 19 Jul 2022 03:33:00 +1000 (AEST) Received: from localhost ([::1]:47332 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUc5-00045d-SG for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:32:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSd-0008Ex-53; Mon, 18 Jul 2022 13:23:11 -0400 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]:37789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSa-0001iF-NL; Mon, 18 Jul 2022 13:23:10 -0400 Received: by mail-ot1-x331.google.com with SMTP id l9-20020a056830268900b006054381dd35so9715790otu.4; Mon, 18 Jul 2022 10:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=t6SEOpqb8davCwSRBuqykmOmBKMno39IJNk4PyJJUgg=; b=Fdh8RRC0uKr+Hln9plF8D5g/yxuCK1HE79IGsxGBQXhM+I10jvZfN6vp0U/aAN8Rfk a5N9SM6uOUPEOJAQloU/yKH7IXOwgk78YvlkQGkay6VkTWR8elJVklhY+Sn+fhOQ65M/ axWgPdB0dUx1X1GrnHs4etNsPeZ5C9oT8kjb4pnJGDIrh1XDDInmfqpZVHLSUyR6XlSO P8OGLGdF4gKoxpZXvHS0e+SFO1O0oLg5dN1EyD0Xep0XOrpCNLg5+H+o7lfBJkvvrO7B npwhygEfGHj/wBNHuJ4We0jYtKMZafT1eoCfkAqPth88QLU8vZDwDXiNuX/5yDJ7P0Ez i+tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=t6SEOpqb8davCwSRBuqykmOmBKMno39IJNk4PyJJUgg=; b=xNnV1noi8TSl8IkjMq5o5+9RktGv6ntBBdSAbX2tKEF0nDBU5SE69Sxsf7wRFGvPKn aKE2MN4NTpL6w3Xc+TSGXLHnUWZdMvK0pBXPFBN/lqy+m7iJ2/ror3KmFVVnMHEJGaC+ KdYFvONHHIFCSx6kciwGDo36XlAEGN8ltbfFvF7VqvJTeq0iyRWJV3XRMyB9Ad5vOUOm rCjzIsdubm3clEtqyfif6JfKjZK1X6Vj6BHmIGAiMAbsADyQsZWhacUSRhkUjfWDIX6O fHfOvbEduIL6P/2nPzO7WAQ1uTb5bpCeG+gKsT11ZHqKBx1IVUj8jWL+GV5d/laT8L2H Zv2w== X-Gm-Message-State: AJIora9O6WyURTibwUPq15f4rKoU09SHQnC8XbeDPAk/YOYdpVyuuI4b u1fGMwaA9wJIGTlVvBBnoOQfijXRGuM= X-Google-Smtp-Source: AGRyM1stEOHDPHBvO17UK88F9agwCyopEK9LgHh+uJ1dHtiucURjQQDnkYcxfYd1mW/XyFTpXntOfw== X-Received: by 2002:a9d:2663:0:b0:61c:7ef9:c117 with SMTP id a90-20020a9d2663000000b0061c7ef9c117mr8426451otb.170.1658164978030; Mon, 18 Jul 2022 10:22:58 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:22:57 -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, Lucas Coutinho , Leandro Lupori Subject: [PULL 18/30] target/ppc: Move slbie to decodetree Date: Mon, 18 Jul 2022 14:21:56 -0300 Message-Id: <20220718172208.1247624-19-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::331; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x331.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Lucas Coutinho Reviewed-by: Leandro Lupori Signed-off-by: Lucas Coutinho Message-Id: <20220701133507.740619-4-lucas.coutinho@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/helper.h | 2 +- target/ppc/insn32.decode | 7 +++++++ target/ppc/mmu-hash64.c | 2 +- target/ppc/translate.c | 13 ------------- target/ppc/translate/storage-ctrl-impl.c.inc | 14 ++++++++++++++ 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 294ef1396b..7c93037257 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -681,7 +681,7 @@ DEF_HELPER_2(load_slb_esid, tl, env, tl) DEF_HELPER_2(load_slb_vsid, tl, env, tl) DEF_HELPER_2(find_slb_vsid, tl, env, tl) DEF_HELPER_FLAGS_2(slbia, TCG_CALL_NO_RWG, void, env, i32) -DEF_HELPER_FLAGS_2(slbie, TCG_CALL_NO_RWG, void, env, tl) +DEF_HELPER_FLAGS_2(SLBIE, TCG_CALL_NO_RWG, void, env, tl) DEF_HELPER_FLAGS_2(slbieg, TCG_CALL_NO_RWG, void, env, tl) #endif DEF_HELPER_FLAGS_2(load_sr, TCG_CALL_NO_RWG, tl, env, tl) diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index 092e01113f..0fe6c33805 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -146,6 +146,9 @@ &X_imm8 xt imm:uint8_t @X_imm8 ...... ..... .. imm:8 .......... . &X_imm8 xt=%x_xt +&X_rb rb +@X_rb ...... ..... ..... rb:5 .......... . &X_rb + &X_uim5 xt uim:uint8_t @X_uim5 ...... ..... ..... uim:5 .......... . &X_uim5 xt=%x_xt @@ -857,6 +860,10 @@ VMODUD 000100 ..... ..... ..... 11011001011 @VX VMODSQ 000100 ..... ..... ..... 11100001011 @VX VMODUQ 000100 ..... ..... ..... 11000001011 @VX +## SLB Management Instructions + +SLBIE 011111 ----- ----- ..... 0110110010 - @X_rb + ## TLB Management Instructions &X_tlbie rb rs ric prs:bool r:bool diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c index da9fe99ff8..03f71a82ec 100644 --- a/target/ppc/mmu-hash64.c +++ b/target/ppc/mmu-hash64.c @@ -197,7 +197,7 @@ static void __helper_slbie(CPUPPCState *env, target_ulong addr, } } -void helper_slbie(CPUPPCState *env, target_ulong addr) +void helper_SLBIE(CPUPPCState *env, target_ulong addr) { __helper_slbie(env, addr, false); } diff --git a/target/ppc/translate.c b/target/ppc/translate.c index e373c39fc8..244eefd965 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -5466,18 +5466,6 @@ static void gen_slbia(DisasContext *ctx) #endif /* defined(CONFIG_USER_ONLY) */ } -/* slbie */ -static void gen_slbie(DisasContext *ctx) -{ -#if defined(CONFIG_USER_ONLY) - GEN_PRIV(ctx); -#else - CHK_SV(ctx); - - gen_helper_slbie(cpu_env, cpu_gpr[rB(ctx->opcode)]); -#endif /* defined(CONFIG_USER_ONLY) */ -} - /* slbieg */ static void gen_slbieg(DisasContext *ctx) { @@ -6894,7 +6882,6 @@ GEN_HANDLER(tlbia, 0x1F, 0x12, 0x0B, 0x03FFFC01, PPC_MEM_TLBIA), GEN_HANDLER(tlbsync, 0x1F, 0x16, 0x11, 0x03FFF801, PPC_MEM_TLBSYNC), #if defined(TARGET_PPC64) GEN_HANDLER(slbia, 0x1F, 0x12, 0x0F, 0x031FFC01, PPC_SLBI), -GEN_HANDLER(slbie, 0x1F, 0x12, 0x0D, 0x03FF0001, PPC_SLBI), GEN_HANDLER_E(slbieg, 0x1F, 0x12, 0x0E, 0x001F0001, PPC_NONE, PPC2_ISA300), GEN_HANDLER_E(slbsync, 0x1F, 0x12, 0x0A, 0x03FFF801, PPC_NONE, PPC2_ISA300), #endif diff --git a/target/ppc/translate/storage-ctrl-impl.c.inc b/target/ppc/translate/storage-ctrl-impl.c.inc index 467c390888..3fa64be067 100644 --- a/target/ppc/translate/storage-ctrl-impl.c.inc +++ b/target/ppc/translate/storage-ctrl-impl.c.inc @@ -23,6 +23,20 @@ #include "mmu-book3s-v3.h" +static bool trans_SLBIE(DisasContext *ctx, arg_SLBIE *a) +{ + REQUIRE_64BIT(ctx); + REQUIRE_INSNS_FLAGS(ctx, SLBI); + REQUIRE_SV(ctx); + +#if !defined(CONFIG_USER_ONLY) && defined(TARGET_PPC64) + gen_helper_SLBIE(cpu_env, cpu_gpr[a->rb]); +#else + qemu_build_not_reached(); +#endif + return true; +} + static bool do_tlbie(DisasContext *ctx, arg_X_tlbie *a, bool local) { #if defined(CONFIG_USER_ONLY) From patchwork Mon Jul 18 17:21:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657633 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=J2cQ+l6e; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LmqKc16Mrz9sFr for ; Tue, 19 Jul 2022 03:52:04 +1000 (AEST) Received: from localhost ([::1]:55188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUuX-0006YJ-UY for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:52:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSd-0008Ez-7u; Mon, 18 Jul 2022 13:23:11 -0400 Received: from mail-oa1-x32.google.com ([2001:4860:4864:20::32]:45656) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSa-0001rX-OI; Mon, 18 Jul 2022 13:23:10 -0400 Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-10c0052da61so25491341fac.12; Mon, 18 Jul 2022 10:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HOa1oDVfER0PKhCUub+DXE/bhE9iK8+7YVFoGPJfgn8=; b=J2cQ+l6eDBJzo9kRga2y72KgZG6Y/vYYL44Nsa3UUZfInDREG3E5zDNO8Q+OQn8DP2 GqviTVEMZRhxMCzyuanHDIE76RPQdXaJlipURnD9oGambLhfanSiNH5QZIjslegR9WD3 AcFL4BTlXD56Eera5KzQJvOQLxnXapnMueGKw/ZQ7aDdJGNEEupoRiZDkLLw2ivBwbP8 6ZB+J7DBLgF2oyU1ZBVJxMbkw2UBmOjZ4d6we8FiFZYYdeWZ0Cy2CTHvzLdij30OyBvt ETW0CPQ2rZallfHOOeduXLvsUU8FMfTRbhX8K0WGMcoGMmr1bDyklLlEySIWH19LKN9h ii5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HOa1oDVfER0PKhCUub+DXE/bhE9iK8+7YVFoGPJfgn8=; b=d/LEZsh/hbbHHntA4nbM9LMu71SEQmXygcVwL1VR/ViRsV1J3Y0VwStDg0L499ZDKn Rdhhs4+liodBfgY055Un6MRzPx80jRaJ5uTbxp/jl3C46GqVH04gNX83zI5JyXl96od+ RID+Vk1grSTmim/prEyTx/q6tRTSqbJth2g42ksx7ukL8Ja1Jr59u4PRv7uIZty85yfY 3xLRjZ25ygjJ/uym8cGxpwEV3gHzzRXD5DLyHhhQthuzN23IwdrLPx+YNW10BTXMSSzI Gj8M+5RIaQisKqxFwzbrFfM/nMU8drY9pTSfosCRMCFnBv4jYgZ36Ac1djCNcTQXWJFJ RSyA== X-Gm-Message-State: AJIora/3GgCuOI2ZIbN+vqYrJxeHljLaKzN127OC0AdOl1p6cncsLHFX DhTItcqdNXL8SJZPeyG4QFEH+qfKi3k= X-Google-Smtp-Source: AGRyM1sSXhb18eg794GtzVc2ZgmI9U+3CzB8tMxDlN2HlgyWvfK0rn1fnWPP2puimvBaIZ0m6rskrw== X-Received: by 2002:a05:6871:714:b0:10c:9c:ea5e with SMTP id f20-20020a056871071400b0010c009cea5emr17597544oap.133.1658164980637; Mon, 18 Jul 2022 10:23:00 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.22.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:23:00 -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, Lucas Coutinho , Leandro Lupori Subject: [PULL 19/30] target/ppc: Move slbieg to decodetree Date: Mon, 18 Jul 2022 14:21:57 -0300 Message-Id: <20220718172208.1247624-20-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::32; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x32.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Lucas Coutinho Reviewed-by: Leandro Lupori Signed-off-by: Lucas Coutinho Message-Id: <20220701133507.740619-5-lucas.coutinho@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/helper.h | 2 +- target/ppc/insn32.decode | 1 + target/ppc/mmu-hash64.c | 2 +- target/ppc/translate.c | 13 ------------- target/ppc/translate/storage-ctrl-impl.c.inc | 14 ++++++++++++++ 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 7c93037257..e5e59d1924 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -682,7 +682,7 @@ DEF_HELPER_2(load_slb_vsid, tl, env, tl) DEF_HELPER_2(find_slb_vsid, tl, env, tl) DEF_HELPER_FLAGS_2(slbia, TCG_CALL_NO_RWG, void, env, i32) DEF_HELPER_FLAGS_2(SLBIE, TCG_CALL_NO_RWG, void, env, tl) -DEF_HELPER_FLAGS_2(slbieg, TCG_CALL_NO_RWG, void, env, tl) +DEF_HELPER_FLAGS_2(SLBIEG, TCG_CALL_NO_RWG, void, env, tl) #endif DEF_HELPER_FLAGS_2(load_sr, TCG_CALL_NO_RWG, tl, env, tl) DEF_HELPER_FLAGS_3(store_sr, TCG_CALL_NO_RWG, void, env, tl, tl) diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index 0fe6c33805..9df73ce30f 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -863,6 +863,7 @@ VMODUQ 000100 ..... ..... ..... 11000001011 @VX ## SLB Management Instructions SLBIE 011111 ----- ----- ..... 0110110010 - @X_rb +SLBIEG 011111 ..... ----- ..... 0111010010 - @X_tb ## TLB Management Instructions diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c index 03f71a82ec..a842fbd6f6 100644 --- a/target/ppc/mmu-hash64.c +++ b/target/ppc/mmu-hash64.c @@ -202,7 +202,7 @@ void helper_SLBIE(CPUPPCState *env, target_ulong addr) __helper_slbie(env, addr, false); } -void helper_slbieg(CPUPPCState *env, target_ulong addr) +void helper_SLBIEG(CPUPPCState *env, target_ulong addr) { __helper_slbie(env, addr, true); } diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 244eefd965..591b6dc817 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -5466,18 +5466,6 @@ static void gen_slbia(DisasContext *ctx) #endif /* defined(CONFIG_USER_ONLY) */ } -/* slbieg */ -static void gen_slbieg(DisasContext *ctx) -{ -#if defined(CONFIG_USER_ONLY) - GEN_PRIV(ctx); -#else - CHK_SV(ctx); - - gen_helper_slbieg(cpu_env, cpu_gpr[rB(ctx->opcode)]); -#endif /* defined(CONFIG_USER_ONLY) */ -} - /* slbsync */ static void gen_slbsync(DisasContext *ctx) { @@ -6882,7 +6870,6 @@ GEN_HANDLER(tlbia, 0x1F, 0x12, 0x0B, 0x03FFFC01, PPC_MEM_TLBIA), GEN_HANDLER(tlbsync, 0x1F, 0x16, 0x11, 0x03FFF801, PPC_MEM_TLBSYNC), #if defined(TARGET_PPC64) GEN_HANDLER(slbia, 0x1F, 0x12, 0x0F, 0x031FFC01, PPC_SLBI), -GEN_HANDLER_E(slbieg, 0x1F, 0x12, 0x0E, 0x001F0001, PPC_NONE, PPC2_ISA300), GEN_HANDLER_E(slbsync, 0x1F, 0x12, 0x0A, 0x03FFF801, PPC_NONE, PPC2_ISA300), #endif GEN_HANDLER(eciwx, 0x1F, 0x16, 0x0D, 0x00000001, PPC_EXTERN), diff --git a/target/ppc/translate/storage-ctrl-impl.c.inc b/target/ppc/translate/storage-ctrl-impl.c.inc index 3fa64be067..d699a370f5 100644 --- a/target/ppc/translate/storage-ctrl-impl.c.inc +++ b/target/ppc/translate/storage-ctrl-impl.c.inc @@ -37,6 +37,20 @@ static bool trans_SLBIE(DisasContext *ctx, arg_SLBIE *a) return true; } +static bool trans_SLBIEG(DisasContext *ctx, arg_SLBIEG *a) +{ + REQUIRE_64BIT(ctx); + REQUIRE_INSNS_FLAGS2(ctx, ISA300); + REQUIRE_SV(ctx); + +#if !defined(CONFIG_USER_ONLY) && defined(TARGET_PPC64) + gen_helper_SLBIEG(cpu_env, cpu_gpr[a->rb]); +#else + qemu_build_not_reached(); +#endif + return true; +} + static bool do_tlbie(DisasContext *ctx, arg_X_tlbie *a, bool local) { #if defined(CONFIG_USER_ONLY) From patchwork Mon Jul 18 17:21:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657636 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=CKujtZVp; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LmqNP4Y3fz9sFr for ; Tue, 19 Jul 2022 03:54:29 +1000 (AEST) Received: from localhost ([::1]:35256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUwt-0003pp-E4 for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:54:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSd-0008EG-15; Mon, 18 Jul 2022 13:23:11 -0400 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]:46814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSa-0001rj-K8; Mon, 18 Jul 2022 13:23:10 -0400 Received: by mail-ot1-x334.google.com with SMTP id by10-20020a056830608a00b0061c1ac80e1dso9688454otb.13; Mon, 18 Jul 2022 10:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KjShZqF2n+i2Je+Lh6nH+KX2X9UmoAmzczLnKEfWG+A=; b=CKujtZVpem5EyI1Kei2ftud1pVCC5C/XCecel7JMUiVu7zCvc1p+eKQ3MQYxKQT/0L P3SrC8z2KaDku9o1m4iWJmmKnlCzkA7XC7Lld2hnstI+VogSMOSF12O96XZNmrbtiF8v vpgL3GEPFCzB42WjkEMb+uTdTH/uRozhLzA3k6VNp/5d8VxuGHpTvdb4po62NX3TEuoJ A145leaVhXhRM+C0ApOq4wLaPrIrWDULy4FJDdPIR0H6L7XrZNg8z1Zvc2hyeV8R0JZG YXct728yRukAFybk8LE7+xiEzmeo78j25cGl5a0ECaybsXWoB/CWxloZXvd3NXQtt1zz yHUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KjShZqF2n+i2Je+Lh6nH+KX2X9UmoAmzczLnKEfWG+A=; b=n6h7OdIIPTLJ5fOE6M0IOvGRrebmcZNEmAZ1CgjUTCZDVgAJoAnJU+Pwc6oc+w9jX4 KaFXhmGC6ZAC3jP5gx3kVFJhTB7aBW302j/0dAaBDWLN3w/rQUU2SUBya0+Gh/YB0MkS FydKlQp0nV6TF84u7Mlg1jpqeVK1Q0BwSbHp0V3Um/6SLz1Z5ca3Znjo0F/2CenklpV8 Eerg/tiRPbr+FT911RscToLfbaXsOgxdb5ym2xZwjcBb+WTKKdIWBd/7WqKBDzgLHVJ+ MZikfZDe/P9DxSLYbidmaj42ZncaQqRJ7O+aHH5m+YLazXO7M3ZF3EKDbcApT73lH0/u 23Kw== X-Gm-Message-State: AJIora/wMKAKqYxo9k5iLeea2ptXq50A+T9d2XrQWW/F6Br5cmVnT50R QsIMc4gLiIsnUbMe59nspFnkPVBcMqw= X-Google-Smtp-Source: AGRyM1vaNfZl2dkdAmbfodpMM3OMmr+ntyFbYczJfdnoT0XwKkTqzt1q7Oau+bkKrrhU0WChKPoQ+g== X-Received: by 2002:a05:6830:b85:b0:605:4e76:f077 with SMTP id a5-20020a0568300b8500b006054e76f077mr11120351otv.211.1658164982978; Mon, 18 Jul 2022 10:23:02 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:23:02 -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, Lucas Coutinho , Leandro Lupori Subject: [PULL 20/30] target/ppc: Move slbia to decodetree Date: Mon, 18 Jul 2022 14:21:58 -0300 Message-Id: <20220718172208.1247624-21-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x334.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Lucas Coutinho Reviewed-by: Leandro Lupori Signed-off-by: Lucas Coutinho Message-Id: <20220701133507.740619-6-lucas.coutinho@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/helper.h | 2 +- target/ppc/insn32.decode | 5 +++++ target/ppc/mmu-hash64.c | 2 +- target/ppc/translate.c | 17 ----------------- target/ppc/translate/storage-ctrl-impl.c.inc | 14 ++++++++++++++ 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index e5e59d1924..c243d9550a 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -680,7 +680,7 @@ DEF_HELPER_FLAGS_3(store_slb, TCG_CALL_NO_RWG, void, env, tl, tl) DEF_HELPER_2(load_slb_esid, tl, env, tl) DEF_HELPER_2(load_slb_vsid, tl, env, tl) DEF_HELPER_2(find_slb_vsid, tl, env, tl) -DEF_HELPER_FLAGS_2(slbia, TCG_CALL_NO_RWG, void, env, i32) +DEF_HELPER_FLAGS_2(SLBIA, TCG_CALL_NO_RWG, void, env, i32) DEF_HELPER_FLAGS_2(SLBIE, TCG_CALL_NO_RWG, void, env, tl) DEF_HELPER_FLAGS_2(SLBIEG, TCG_CALL_NO_RWG, void, env, tl) #endif diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index 9df73ce30f..0e214b359c 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -146,6 +146,9 @@ &X_imm8 xt imm:uint8_t @X_imm8 ...... ..... .. imm:8 .......... . &X_imm8 xt=%x_xt +&X_ih ih:uint8_t +@X_ih ...... .. ih:3 ..... ..... .......... . &X_ih + &X_rb rb @X_rb ...... ..... ..... rb:5 .......... . &X_rb @@ -865,6 +868,8 @@ VMODUQ 000100 ..... ..... ..... 11000001011 @VX SLBIE 011111 ----- ----- ..... 0110110010 - @X_rb SLBIEG 011111 ..... ----- ..... 0111010010 - @X_tb +SLBIA 011111 --... ----- ----- 0111110010 - @X_ih + ## TLB Management Instructions &X_tlbie rb rs ric prs:bool r:bool diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c index a842fbd6f6..dd2c7e588f 100644 --- a/target/ppc/mmu-hash64.c +++ b/target/ppc/mmu-hash64.c @@ -101,7 +101,7 @@ void dump_slb(PowerPCCPU *cpu) } #ifdef CONFIG_TCG -void helper_slbia(CPUPPCState *env, uint32_t ih) +void helper_SLBIA(CPUPPCState *env, uint32_t ih) { PowerPCCPU *cpu = env_archcpu(env); int starting_entry; diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 591b6dc817..4435865388 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -5450,22 +5450,6 @@ static void gen_tlbsync(DisasContext *ctx) } #if defined(TARGET_PPC64) -/* slbia */ -static void gen_slbia(DisasContext *ctx) -{ -#if defined(CONFIG_USER_ONLY) - GEN_PRIV(ctx); -#else - uint32_t ih = (ctx->opcode >> 21) & 0x7; - TCGv_i32 t0 = tcg_const_i32(ih); - - CHK_SV(ctx); - - gen_helper_slbia(cpu_env, t0); - tcg_temp_free_i32(t0); -#endif /* defined(CONFIG_USER_ONLY) */ -} - /* slbsync */ static void gen_slbsync(DisasContext *ctx) { @@ -6869,7 +6853,6 @@ GEN_HANDLER(tlbia, 0x1F, 0x12, 0x0B, 0x03FFFC01, PPC_MEM_TLBIA), */ GEN_HANDLER(tlbsync, 0x1F, 0x16, 0x11, 0x03FFF801, PPC_MEM_TLBSYNC), #if defined(TARGET_PPC64) -GEN_HANDLER(slbia, 0x1F, 0x12, 0x0F, 0x031FFC01, PPC_SLBI), GEN_HANDLER_E(slbsync, 0x1F, 0x12, 0x0A, 0x03FFF801, PPC_NONE, PPC2_ISA300), #endif GEN_HANDLER(eciwx, 0x1F, 0x16, 0x0D, 0x00000001, PPC_EXTERN), diff --git a/target/ppc/translate/storage-ctrl-impl.c.inc b/target/ppc/translate/storage-ctrl-impl.c.inc index d699a370f5..c454ce8c7f 100644 --- a/target/ppc/translate/storage-ctrl-impl.c.inc +++ b/target/ppc/translate/storage-ctrl-impl.c.inc @@ -51,6 +51,20 @@ static bool trans_SLBIEG(DisasContext *ctx, arg_SLBIEG *a) return true; } +static bool trans_SLBIA(DisasContext *ctx, arg_SLBIA *a) +{ + REQUIRE_64BIT(ctx); + REQUIRE_INSNS_FLAGS(ctx, SLBI); + REQUIRE_SV(ctx); + +#if !defined(CONFIG_USER_ONLY) && defined(TARGET_PPC64) + gen_helper_SLBIA(cpu_env, tcg_constant_i32(a->ih)); +#else + qemu_build_not_reached(); +#endif + return true; +} + static bool do_tlbie(DisasContext *ctx, arg_X_tlbie *a, bool local) { #if defined(CONFIG_USER_ONLY) From patchwork Mon Jul 18 17:21:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657635 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=dSUKOhmn; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LmqMf409Zz9sFr for ; Tue, 19 Jul 2022 03:53:50 +1000 (AEST) Received: from localhost ([::1]:60344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUwG-0001gV-Df for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:53:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSe-0008GE-77; Mon, 18 Jul 2022 13:23:12 -0400 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]:34351) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSa-0001rv-Mh; Mon, 18 Jul 2022 13:23:11 -0400 Received: by mail-ot1-x334.google.com with SMTP id g19-20020a9d1293000000b0061c7bfda5dfso9361211otg.1; Mon, 18 Jul 2022 10:23:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nNmrV14lXrTZBlLMXgEh75SGPZ8v7pCcjk424OplMj4=; b=dSUKOhmnrtmcq6iVeP2iAlc7FiDjr6MIGyqGrs40DE5Qshb2pU6jO3J78maNpKREe2 ur7YSzIJv7fzesvp/rpR8WZf7MEXlzGetrNqbgNZCB5V/uxSCtL7AN9ycQMVUTwo3C7I 8/tp/oElnIx10Eh9xkbsiUiH40ZcdV/XfkzH6cNvFL6pVYn17FJ7jER+gATcFBtUvqPa ufqPuPT960yQkbCgkNeQL1/jvJVxOYjw4RR6HZbd6J5JOPERgLIqOBu7AspZfzZ9HsVs n9uUjvm9oD3Fe0N8dbVE9IeANsQpta2Oq/nwSzrCdqfrmxeeT+cIwC/d3IpERkPDp79f nTbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nNmrV14lXrTZBlLMXgEh75SGPZ8v7pCcjk424OplMj4=; b=2OyVnIoM+GGbnVDJDCMcu8IkWQCgp+Iw7I9ZpW00/f+Gsk9cxwnV4b00jIf6z4yZiN zZqeGpY5GPrHreCZfptXnEN3MjIUW3BH7skQEBDQKC+KaD8h6Ka4WXKndj979pLC1/mO bahsWyjrawNHCjdLG8CDv0sFic2IzxkDXSR/zD6njSewFHRM1MKKyTk9vSPY2inX8wSZ UtmJw1w6bcrXG7ROkWdcfaPJ0b7Kt6g8PHy1im/TyvsX2TPA2nD76MBwvbqbhYn7ZIEE tR1MLBGQ2z2TtbWVskX2om1VtJ276ep4d2+wSner51Sw9VK9br+yDc1Sj4TirezeKGHM nAcw== X-Gm-Message-State: AJIora/2syJDjexmyjlOC5sF9ghlsfqzhQPkjP+2GCZN+bzt87TSidXx hglbrkpc6nzxLRk7RuC66BNyJwbAiCg= X-Google-Smtp-Source: AGRyM1u8WEZmUb8mTcP7v8rzYfZh+hcWMhX+JFN+MiYXpqB+X/p4uiBxsGWI+ht/bmUCwKU1SD5vNg== X-Received: by 2002:a05:6830:6613:b0:61c:acf8:8e41 with SMTP id cp19-20020a056830661300b0061cacf88e41mr1084311otb.298.1658164985281; Mon, 18 Jul 2022 10:23:05 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.23.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:23:05 -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, Lucas Coutinho , Leandro Lupori Subject: [PULL 21/30] target/ppc: Move slbmte to decodetree Date: Mon, 18 Jul 2022 14:21:59 -0300 Message-Id: <20220718172208.1247624-22-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x334.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Lucas Coutinho Reviewed-by: Leandro Lupori Signed-off-by: Lucas Coutinho Message-Id: <20220701133507.740619-7-lucas.coutinho@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/helper.h | 2 +- target/ppc/insn32.decode | 2 ++ target/ppc/mmu-hash64.c | 2 +- target/ppc/translate.c | 14 -------------- target/ppc/translate/storage-ctrl-impl.c.inc | 14 ++++++++++++++ 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index c243d9550a..98d6c40ac0 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -676,7 +676,7 @@ DEF_HELPER_FLAGS_2(tlbiva, TCG_CALL_NO_RWG, void, env, tl) #if defined(TARGET_PPC64) DEF_HELPER_FLAGS_4(tlbie_isa300, TCG_CALL_NO_WG, void, \ env, tl, tl, i32) -DEF_HELPER_FLAGS_3(store_slb, TCG_CALL_NO_RWG, void, env, tl, tl) +DEF_HELPER_FLAGS_3(SLBMTE, TCG_CALL_NO_RWG, void, env, tl, tl) DEF_HELPER_2(load_slb_esid, tl, env, tl) DEF_HELPER_2(load_slb_vsid, tl, env, tl) DEF_HELPER_2(find_slb_vsid, tl, env, tl) diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index 0e214b359c..2fc6e9cb27 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -870,6 +870,8 @@ SLBIEG 011111 ..... ----- ..... 0111010010 - @X_tb SLBIA 011111 --... ----- ----- 0111110010 - @X_ih +SLBMTE 011111 ..... ----- ..... 0110010010 - @X_tb + ## TLB Management Instructions &X_tlbie rb rs ric prs:bool r:bool diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c index dd2c7e588f..1922960608 100644 --- a/target/ppc/mmu-hash64.c +++ b/target/ppc/mmu-hash64.c @@ -309,7 +309,7 @@ static int ppc_find_slb_vsid(PowerPCCPU *cpu, target_ulong rb, return 0; } -void helper_store_slb(CPUPPCState *env, target_ulong rb, target_ulong rs) +void helper_SLBMTE(CPUPPCState *env, target_ulong rb, target_ulong rs) { PowerPCCPU *cpu = env_archcpu(env); diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 4435865388..169e97a706 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -5351,19 +5351,6 @@ static void gen_mtsrin_64b(DisasContext *ctx) #endif /* defined(CONFIG_USER_ONLY) */ } -/* slbmte */ -static void gen_slbmte(DisasContext *ctx) -{ -#if defined(CONFIG_USER_ONLY) - GEN_PRIV(ctx); -#else - CHK_SV(ctx); - - gen_helper_store_slb(cpu_env, cpu_gpr[rB(ctx->opcode)], - cpu_gpr[rS(ctx->opcode)]); -#endif /* defined(CONFIG_USER_ONLY) */ -} - static void gen_slbmfee(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) @@ -6841,7 +6828,6 @@ GEN_HANDLER2(mfsrin_64b, "mfsrin", 0x1F, 0x13, 0x14, 0x001F0001, GEN_HANDLER2(mtsr_64b, "mtsr", 0x1F, 0x12, 0x06, 0x0010F801, PPC_SEGMENT_64B), GEN_HANDLER2(mtsrin_64b, "mtsrin", 0x1F, 0x12, 0x07, 0x001F0001, PPC_SEGMENT_64B), -GEN_HANDLER2(slbmte, "slbmte", 0x1F, 0x12, 0x0C, 0x001F0001, PPC_SEGMENT_64B), GEN_HANDLER2(slbmfee, "slbmfee", 0x1F, 0x13, 0x1C, 0x001F0001, PPC_SEGMENT_64B), GEN_HANDLER2(slbmfev, "slbmfev", 0x1F, 0x13, 0x1A, 0x001F0001, PPC_SEGMENT_64B), GEN_HANDLER2(slbfee_, "slbfee.", 0x1F, 0x13, 0x1E, 0x001F0000, PPC_SEGMENT_64B), diff --git a/target/ppc/translate/storage-ctrl-impl.c.inc b/target/ppc/translate/storage-ctrl-impl.c.inc index c454ce8c7f..47d672d29a 100644 --- a/target/ppc/translate/storage-ctrl-impl.c.inc +++ b/target/ppc/translate/storage-ctrl-impl.c.inc @@ -65,6 +65,20 @@ static bool trans_SLBIA(DisasContext *ctx, arg_SLBIA *a) return true; } +static bool trans_SLBMTE(DisasContext *ctx, arg_SLBMTE *a) +{ + REQUIRE_64BIT(ctx); + REQUIRE_INSNS_FLAGS(ctx, SEGMENT_64B); + REQUIRE_SV(ctx); + +#if !defined(CONFIG_USER_ONLY) && defined(TARGET_PPC64) + gen_helper_SLBMTE(cpu_env, cpu_gpr[a->rb], cpu_gpr[a->rt]); +#else + qemu_build_not_reached(); +#endif + return true; +} + static bool do_tlbie(DisasContext *ctx, arg_X_tlbie *a, bool local) { #if defined(CONFIG_USER_ONLY) From patchwork Mon Jul 18 17:22:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657628 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=MVl77im8; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LmqGQ5zQpz9sFr for ; Tue, 19 Jul 2022 03:49:18 +1000 (AEST) Received: from localhost ([::1]:48352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUrs-00016F-NS for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:49:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSe-0008ID-Lg; Mon, 18 Jul 2022 13:23:12 -0400 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]:44602) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSc-0001sX-Dg; Mon, 18 Jul 2022 13:23:12 -0400 Received: by mail-ot1-x335.google.com with SMTP id o16-20020a9d4110000000b0061cac66bd6dso1249351ote.11; Mon, 18 Jul 2022 10:23:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R2+q9+GnVKeandXKpBARg4+SXc08zNfN++i7bbZeDFc=; b=MVl77im81D2BGeaewqYBA19GTrqQvhn/YNdZoI8JGfFJfvCAkFh9LXZojRgo0wQ9Ca qguZvRHdUhjdPGbnoX9kvFUePsNZ4G5O/Fqbz/019xFVSj53jUyCWpUl9ydENgY7eVgh L75s5PKqW6FVWzWedGl5vxlfbFPtvRM01ioxhl99sWpZvzFZD/gvuTUFAUXtiDMGqNcl Bdo4Spimz+PjgEOrP3e0pLj33U77iDt3c21HCMvZuvUINPJ1JfkWLWbDWrnebYXNRFCE yK710OuzaP6ELwowsqFqXq3anK7KJebHfIxAm1UuSr15VVKTiZkilFFIHUI4PV7CVxav 8Rlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R2+q9+GnVKeandXKpBARg4+SXc08zNfN++i7bbZeDFc=; b=nl2pjCR9QtB7r7pGhKF6DPxqac4klPzUGh3vX2da7UHJUiPqDIF/r2jhoqF5MGGlcz Ifc+mwgm+UT/tNauLKkknyrFHFEebu61BHsvE8MKMCunvF0J9k7q0QSndMLG7WB8e1eM zoG6Z0Y3af2Ovrb7rYqvIZ9vCD1hoQGBwCjlr3KrWvS1t8Bjr832HZT7M8/WNatY57Jr 0F92q8Vyx3ERL/lntAS7AjLdarkS4KcIedGi5Cswo9J2WE4hfo+qCoiPVKfhaI+2pVmx qkmsic6Z7jDZG2R9wYjnNE2CnU1QHh8n8r0gdKVsGKOKOv8W1Jx+coPiZHRqICKS2+ZB Oflw== X-Gm-Message-State: AJIora8R0VF9KeKKEKEM5tosczzJpITchfPbZN2okq88V8qkr+sfLfQc 7cDIsxiDMJdpItOSOyhp4UqtwbYjncM= X-Google-Smtp-Source: AGRyM1uoVFxbKr3Re9UrLPfU3qT0tUVc/jfCtJodVMc+32iXkV5OpwQ0lBUo728G4IcacroFgjg7lw== X-Received: by 2002:a05:6830:2a01:b0:606:d153:1ba0 with SMTP id y1-20020a0568302a0100b00606d1531ba0mr11375802otu.35.1658164987745; Mon, 18 Jul 2022 10:23:07 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.23.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:23:07 -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, Lucas Coutinho , Leandro Lupori Subject: [PULL 22/30] target/ppc: Move slbmfev to decodetree Date: Mon, 18 Jul 2022 14:22:00 -0300 Message-Id: <20220718172208.1247624-23-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::335; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x335.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Lucas Coutinho Reviewed-by: Leandro Lupori Signed-off-by: Lucas Coutinho Message-Id: <20220701133507.740619-8-lucas.coutinho@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/helper.h | 2 +- target/ppc/insn32.decode | 2 ++ target/ppc/mmu-hash64.c | 2 +- target/ppc/translate.c | 12 ------------ target/ppc/translate/storage-ctrl-impl.c.inc | 14 ++++++++++++++ 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 98d6c40ac0..d1f9dff58f 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -678,7 +678,7 @@ DEF_HELPER_FLAGS_4(tlbie_isa300, TCG_CALL_NO_WG, void, \ env, tl, tl, i32) DEF_HELPER_FLAGS_3(SLBMTE, TCG_CALL_NO_RWG, void, env, tl, tl) DEF_HELPER_2(load_slb_esid, tl, env, tl) -DEF_HELPER_2(load_slb_vsid, tl, env, tl) +DEF_HELPER_2(SLBMFEV, tl, env, tl) DEF_HELPER_2(find_slb_vsid, tl, env, tl) DEF_HELPER_FLAGS_2(SLBIA, TCG_CALL_NO_RWG, void, env, i32) DEF_HELPER_FLAGS_2(SLBIE, TCG_CALL_NO_RWG, void, env, tl) diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index 2fc6e9cb27..0e002999bd 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -872,6 +872,8 @@ SLBIA 011111 --... ----- ----- 0111110010 - @X_ih SLBMTE 011111 ..... ----- ..... 0110010010 - @X_tb +SLBMFEV 011111 ..... ----- ..... 1101010011 - @X_tb + ## TLB Management Instructions &X_tlbie rb rs ric prs:bool r:bool diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c index 1922960608..7854b91043 100644 --- a/target/ppc/mmu-hash64.c +++ b/target/ppc/mmu-hash64.c @@ -343,7 +343,7 @@ target_ulong helper_find_slb_vsid(CPUPPCState *env, target_ulong rb) return rt; } -target_ulong helper_load_slb_vsid(CPUPPCState *env, target_ulong rb) +target_ulong helper_SLBMFEV(CPUPPCState *env, target_ulong rb) { PowerPCCPU *cpu = env_archcpu(env); target_ulong rt = 0; diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 169e97a706..e48a306036 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -5363,17 +5363,6 @@ static void gen_slbmfee(DisasContext *ctx) #endif /* defined(CONFIG_USER_ONLY) */ } -static void gen_slbmfev(DisasContext *ctx) -{ -#if defined(CONFIG_USER_ONLY) - GEN_PRIV(ctx); -#else - CHK_SV(ctx); - - gen_helper_load_slb_vsid(cpu_gpr[rS(ctx->opcode)], cpu_env, - cpu_gpr[rB(ctx->opcode)]); -#endif /* defined(CONFIG_USER_ONLY) */ -} static void gen_slbfee_(DisasContext *ctx) { @@ -6829,7 +6818,6 @@ GEN_HANDLER2(mtsr_64b, "mtsr", 0x1F, 0x12, 0x06, 0x0010F801, PPC_SEGMENT_64B), GEN_HANDLER2(mtsrin_64b, "mtsrin", 0x1F, 0x12, 0x07, 0x001F0001, PPC_SEGMENT_64B), GEN_HANDLER2(slbmfee, "slbmfee", 0x1F, 0x13, 0x1C, 0x001F0001, PPC_SEGMENT_64B), -GEN_HANDLER2(slbmfev, "slbmfev", 0x1F, 0x13, 0x1A, 0x001F0001, PPC_SEGMENT_64B), GEN_HANDLER2(slbfee_, "slbfee.", 0x1F, 0x13, 0x1E, 0x001F0000, PPC_SEGMENT_64B), #endif GEN_HANDLER(tlbia, 0x1F, 0x12, 0x0B, 0x03FFFC01, PPC_MEM_TLBIA), diff --git a/target/ppc/translate/storage-ctrl-impl.c.inc b/target/ppc/translate/storage-ctrl-impl.c.inc index 47d672d29a..11f44e9366 100644 --- a/target/ppc/translate/storage-ctrl-impl.c.inc +++ b/target/ppc/translate/storage-ctrl-impl.c.inc @@ -79,6 +79,20 @@ static bool trans_SLBMTE(DisasContext *ctx, arg_SLBMTE *a) return true; } +static bool trans_SLBMFEV(DisasContext *ctx, arg_SLBMFEV *a) +{ + REQUIRE_64BIT(ctx); + REQUIRE_INSNS_FLAGS(ctx, SEGMENT_64B); + REQUIRE_SV(ctx); + +#if !defined(CONFIG_USER_ONLY) && defined(TARGET_PPC64) + gen_helper_SLBMFEV(cpu_gpr[a->rt], cpu_env, cpu_gpr[a->rb]); +#else + qemu_build_not_reached(); +#endif + return true; +} + static bool do_tlbie(DisasContext *ctx, arg_X_tlbie *a, bool local) { #if defined(CONFIG_USER_ONLY) From patchwork Mon Jul 18 17:22:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657634 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=iICHX96d; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LmqLX4mXLz9sFr for ; Tue, 19 Jul 2022 03:52:52 +1000 (AEST) Received: from localhost ([::1]:56788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUvK-0007fK-1z for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:52:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43710) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSf-0008LY-HY; Mon, 18 Jul 2022 13:23:13 -0400 Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]:35468) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSd-0001tG-Nr; Mon, 18 Jul 2022 13:23:13 -0400 Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-10cf9f5b500so24365009fac.2; Mon, 18 Jul 2022 10:23:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JneWFqL6Svykeck+7bHr9XVjlGFRmRmTHw2TtqOVAmU=; b=iICHX96dLQskR9ARt9y6n7dktx6u984ZeqjqIAosWFrQOSobqU1IyYKc+IdKAL+GjF 6OxyOj/s/vdQt+uAalcHg5MaUjiI0XguS4jUC3XvwT/vmdJcaDfo9VE3kZ+MlitoRYoA pOx4G+BLia29gmP3rrE4plPuEQcLJvY/sq6WdxFk83cHvHPIT2iDgyy7vSV13O6FE9vy AzWNIVK7aUd+cqTQLTrjFTwubldvhVPQddNMEOgOzcB7PMYQ8BOag2QNEbuAejzLJIID Uh8CCUcijSiPs4HVxG0MCUBrzU4O81WmvJbpWBtgejutbAkdSn2fMA+ILhJpj4IZeg/Z jPNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JneWFqL6Svykeck+7bHr9XVjlGFRmRmTHw2TtqOVAmU=; b=W+nrjJdTsvVWQSTeilSk3/FXAkITdSZb+xxdUWxy+PIcUHBLn9waAzcQa3cu59ndFM rmRADcCEm2kevaLKTdlCvZgL5/YlhBVhLpvQ11CrIwFoVavOQsneTBrqTAG9mF4TuFPw uKauC8tnk8tIapfDiIGQHODpbn1mbYb/MHxpIP4vmpImVIpUfrYN0uk6pgWcRnRhDRsf Dje8aRdBykN9CAe1mmoOmHKgjwkaGQBrZwHR0vOUQGVohnXmvWgvRZl7KqfopOGE73Oq TTryX6qgXMirfTKGPvZ4OINv8lMaHA0p7iYqTguf66dXuVB/oKJDmvDkEOQA59ui2xTm P7Lg== X-Gm-Message-State: AJIora9YCqUzrUkUwKbz92nwX0j+3biy8jEmzTposc97UMMxCgyVRfV8 X705lDg4sDCyJuBvU3fLD2vzszRyQMo= X-Google-Smtp-Source: AGRyM1sTcKhsdLZK+s5qwbNn5GCLOrfjJqDWPs1mcIvH+Ch20fJheesc54RNLwINL59Wnyoz3sNbOw== X-Received: by 2002:a05:6871:88b:b0:f2:bdee:1461 with SMTP id r11-20020a056871088b00b000f2bdee1461mr15763564oaq.299.1658164990131; Mon, 18 Jul 2022 10:23:10 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.23.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:23:09 -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, Lucas Coutinho , Leandro Lupori Subject: [PULL 23/30] target/ppc: Move slbmfee to decodetree Date: Mon, 18 Jul 2022 14:22:01 -0300 Message-Id: <20220718172208.1247624-24-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::33; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x33.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Lucas Coutinho Reviewed-by: Leandro Lupori Signed-off-by: Lucas Coutinho Message-Id: <20220701133507.740619-9-lucas.coutinho@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/helper.h | 2 +- target/ppc/insn32.decode | 1 + target/ppc/mmu-hash64.c | 2 +- target/ppc/translate.c | 13 ------------- target/ppc/translate/storage-ctrl-impl.c.inc | 14 ++++++++++++++ 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index d1f9dff58f..0baa2ca0f3 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -677,7 +677,7 @@ DEF_HELPER_FLAGS_2(tlbiva, TCG_CALL_NO_RWG, void, env, tl) DEF_HELPER_FLAGS_4(tlbie_isa300, TCG_CALL_NO_WG, void, \ env, tl, tl, i32) DEF_HELPER_FLAGS_3(SLBMTE, TCG_CALL_NO_RWG, void, env, tl, tl) -DEF_HELPER_2(load_slb_esid, tl, env, tl) +DEF_HELPER_2(SLBMFEE, tl, env, tl) DEF_HELPER_2(SLBMFEV, tl, env, tl) DEF_HELPER_2(find_slb_vsid, tl, env, tl) DEF_HELPER_FLAGS_2(SLBIA, TCG_CALL_NO_RWG, void, env, i32) diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index 0e002999bd..8b431c6f32 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -873,6 +873,7 @@ SLBIA 011111 --... ----- ----- 0111110010 - @X_ih SLBMTE 011111 ..... ----- ..... 0110010010 - @X_tb SLBMFEV 011111 ..... ----- ..... 1101010011 - @X_tb +SLBMFEE 011111 ..... ----- ..... 1110010011 - @X_tb ## TLB Management Instructions diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c index 7854b91043..5d73d64436 100644 --- a/target/ppc/mmu-hash64.c +++ b/target/ppc/mmu-hash64.c @@ -319,7 +319,7 @@ void helper_SLBMTE(CPUPPCState *env, target_ulong rb, target_ulong rs) } } -target_ulong helper_load_slb_esid(CPUPPCState *env, target_ulong rb) +target_ulong helper_SLBMFEE(CPUPPCState *env, target_ulong rb) { PowerPCCPU *cpu = env_archcpu(env); target_ulong rt = 0; diff --git a/target/ppc/translate.c b/target/ppc/translate.c index e48a306036..eae60f5370 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -5351,18 +5351,6 @@ static void gen_mtsrin_64b(DisasContext *ctx) #endif /* defined(CONFIG_USER_ONLY) */ } -static void gen_slbmfee(DisasContext *ctx) -{ -#if defined(CONFIG_USER_ONLY) - GEN_PRIV(ctx); -#else - CHK_SV(ctx); - - gen_helper_load_slb_esid(cpu_gpr[rS(ctx->opcode)], cpu_env, - cpu_gpr[rB(ctx->opcode)]); -#endif /* defined(CONFIG_USER_ONLY) */ -} - static void gen_slbfee_(DisasContext *ctx) { @@ -6817,7 +6805,6 @@ GEN_HANDLER2(mfsrin_64b, "mfsrin", 0x1F, 0x13, 0x14, 0x001F0001, GEN_HANDLER2(mtsr_64b, "mtsr", 0x1F, 0x12, 0x06, 0x0010F801, PPC_SEGMENT_64B), GEN_HANDLER2(mtsrin_64b, "mtsrin", 0x1F, 0x12, 0x07, 0x001F0001, PPC_SEGMENT_64B), -GEN_HANDLER2(slbmfee, "slbmfee", 0x1F, 0x13, 0x1C, 0x001F0001, PPC_SEGMENT_64B), GEN_HANDLER2(slbfee_, "slbfee.", 0x1F, 0x13, 0x1E, 0x001F0000, PPC_SEGMENT_64B), #endif GEN_HANDLER(tlbia, 0x1F, 0x12, 0x0B, 0x03FFFC01, PPC_MEM_TLBIA), diff --git a/target/ppc/translate/storage-ctrl-impl.c.inc b/target/ppc/translate/storage-ctrl-impl.c.inc index 11f44e9366..f0854b137f 100644 --- a/target/ppc/translate/storage-ctrl-impl.c.inc +++ b/target/ppc/translate/storage-ctrl-impl.c.inc @@ -93,6 +93,20 @@ static bool trans_SLBMFEV(DisasContext *ctx, arg_SLBMFEV *a) return true; } +static bool trans_SLBMFEE(DisasContext *ctx, arg_SLBMFEE *a) +{ + REQUIRE_64BIT(ctx); + REQUIRE_INSNS_FLAGS(ctx, SEGMENT_64B); + REQUIRE_SV(ctx); + +#if !defined(CONFIG_USER_ONLY) && defined(TARGET_PPC64) + gen_helper_SLBMFEE(cpu_gpr[a->rt], cpu_env, cpu_gpr[a->rb]); +#else + qemu_build_not_reached(); +#endif + return true; +} + static bool do_tlbie(DisasContext *ctx, arg_X_tlbie *a, bool local) { #if defined(CONFIG_USER_ONLY) From patchwork Mon Jul 18 17:22:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657638 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=RCr+fN8C; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LmqQW56vwz9sFr for ; Tue, 19 Jul 2022 03:56:18 +1000 (AEST) Received: from localhost ([::1]:40172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUyd-0007BB-5z for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:56:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSt-0008Tm-0l; Mon, 18 Jul 2022 13:23:31 -0400 Received: from mail-oa1-x32.google.com ([2001:4860:4864:20::32]:45656) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSg-0001rX-Aa; Mon, 18 Jul 2022 13:23:15 -0400 Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-10c0052da61so25492985fac.12; Mon, 18 Jul 2022 10:23:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ecm0aGPpM/Brdyc0zvZDqO70yYxydNUKE7SsapLu95s=; b=RCr+fN8CSja5ahxfiL/rFMKmZMs/1wX+AMabJOqZAUUkYamXy/icYf7UOvSIIU6nmS 8yoBwescatzqtLFPQSTcmw6rU08+ZgDXed9AMeGEERtZ0To+AE4Qje0/d8qav+77InJo BZFF+3h3dZMNwL6fefxYchHWWoNmSrxkONN8AGbbBTbn38Mkph0/l+Czx99srYaDWeeX i01eJlvWKLLsfpiFQuQ5jbaMYlqVdOKohNWIZGadajJJ8RaewURG7YhGuiZ+qCHahFCB 5gvOxv8PGWFXNztOFJowVLiRULPB84b92+D6A8eSYDeQRgSBWW3y3tDeNUpFnWr49KH9 fTpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ecm0aGPpM/Brdyc0zvZDqO70yYxydNUKE7SsapLu95s=; b=KZr7OYvEATIHs6mIGsXSoZWM/Iek4BkgrGdJ5XGcvLgA1R0PeNM768g+HkcIIaKTHA eak5Q9IPlvxtVStg/M6nnSlYp/YSyLJncGfMWGrx7DVGb80o/howhLQFCBB0xEPivGoX zuan4lF98pMM4TqNAGnEhW9rXp4gjVzdkQalExt2tynWpIx+CFyteJqLkKCtghBxDoNC rHjRMwgEUpH1ygc5FIPoaFdFkcMGNN2SBiLEX6nsulCTOyy5IffrkV+FPz8lcG19mTpY LcHsDyO4n6OwfkqHZvy0MBA0j1MhhLDAmEWbI4hk1Fy2MyN60STe4X6CDPdZoT4lQwgI +JAw== X-Gm-Message-State: AJIora8G4ckGFMSlBuskQjttzsDo1PojJpyGPCbd/v/d/DExmxt1mnM0 6ELHFiyX6/BbvGFaq5KFLgIAtg7dX4s= X-Google-Smtp-Source: AGRyM1uesdNXt3fqvD9GBy/ckRE7MOY7fOW8riJsXX4kVbjD6fbejB4JmI/nxdUg285r9oPO6PKLdQ== X-Received: by 2002:a05:6808:1416:b0:337:e23b:1d3c with SMTP id w22-20020a056808141600b00337e23b1d3cmr16517140oiv.111.1658164993237; Mon, 18 Jul 2022 10:23:13 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.23.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:23:12 -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, Lucas Coutinho , Leandro Lupori Subject: [PULL 24/30] target/ppc: Move slbfee to decodetree Date: Mon, 18 Jul 2022 14:22:02 -0300 Message-Id: <20220718172208.1247624-25-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::32; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x32.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Lucas Coutinho Reviewed-by: Leandro Lupori Signed-off-by: Lucas Coutinho Message-Id: <20220701133507.740619-10-lucas.coutinho@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/helper.h | 2 +- target/ppc/insn32.decode | 2 ++ target/ppc/mmu-hash64.c | 2 +- target/ppc/translate.c | 26 --------------- target/ppc/translate/storage-ctrl-impl.c.inc | 34 ++++++++++++++++++++ 5 files changed, 38 insertions(+), 28 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 0baa2ca0f3..ef2dc30194 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -679,7 +679,7 @@ DEF_HELPER_FLAGS_4(tlbie_isa300, TCG_CALL_NO_WG, void, \ DEF_HELPER_FLAGS_3(SLBMTE, TCG_CALL_NO_RWG, void, env, tl, tl) DEF_HELPER_2(SLBMFEE, tl, env, tl) DEF_HELPER_2(SLBMFEV, tl, env, tl) -DEF_HELPER_2(find_slb_vsid, tl, env, tl) +DEF_HELPER_2(SLBFEE, tl, env, tl) DEF_HELPER_FLAGS_2(SLBIA, TCG_CALL_NO_RWG, void, env, i32) DEF_HELPER_FLAGS_2(SLBIE, TCG_CALL_NO_RWG, void, env, tl) DEF_HELPER_FLAGS_2(SLBIEG, TCG_CALL_NO_RWG, void, env, tl) diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index 8b431c6f32..5049c98691 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -875,6 +875,8 @@ SLBMTE 011111 ..... ----- ..... 0110010010 - @X_tb SLBMFEV 011111 ..... ----- ..... 1101010011 - @X_tb SLBMFEE 011111 ..... ----- ..... 1110010011 - @X_tb +SLBFEE 011111 ..... ----- ..... 1111010011 1 @X_tb + ## TLB Management Instructions &X_tlbie rb rs ric prs:bool r:bool diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c index 5d73d64436..7ec7a67a78 100644 --- a/target/ppc/mmu-hash64.c +++ b/target/ppc/mmu-hash64.c @@ -331,7 +331,7 @@ target_ulong helper_SLBMFEE(CPUPPCState *env, target_ulong rb) return rt; } -target_ulong helper_find_slb_vsid(CPUPPCState *env, target_ulong rb) +target_ulong helper_SLBFEE(CPUPPCState *env, target_ulong rb) { PowerPCCPU *cpu = env_archcpu(env); target_ulong rt = 0; diff --git a/target/ppc/translate.c b/target/ppc/translate.c index eae60f5370..d7a785164b 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -5351,31 +5351,6 @@ static void gen_mtsrin_64b(DisasContext *ctx) #endif /* defined(CONFIG_USER_ONLY) */ } - -static void gen_slbfee_(DisasContext *ctx) -{ -#if defined(CONFIG_USER_ONLY) - gen_hvpriv_exception(ctx, POWERPC_EXCP_PRIV_OPC); -#else - TCGLabel *l1, *l2; - - if (unlikely(ctx->pr)) { - gen_hvpriv_exception(ctx, POWERPC_EXCP_PRIV_OPC); - return; - } - gen_helper_find_slb_vsid(cpu_gpr[rS(ctx->opcode)], cpu_env, - cpu_gpr[rB(ctx->opcode)]); - l1 = gen_new_label(); - l2 = gen_new_label(); - tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so); - tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[rS(ctx->opcode)], -1, l1); - tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], CRF_EQ); - tcg_gen_br(l2); - gen_set_label(l1); - tcg_gen_movi_tl(cpu_gpr[rS(ctx->opcode)], 0); - gen_set_label(l2); -#endif -} #endif /* defined(TARGET_PPC64) */ /*** Lookaside buffer management ***/ @@ -6805,7 +6780,6 @@ GEN_HANDLER2(mfsrin_64b, "mfsrin", 0x1F, 0x13, 0x14, 0x001F0001, GEN_HANDLER2(mtsr_64b, "mtsr", 0x1F, 0x12, 0x06, 0x0010F801, PPC_SEGMENT_64B), GEN_HANDLER2(mtsrin_64b, "mtsrin", 0x1F, 0x12, 0x07, 0x001F0001, PPC_SEGMENT_64B), -GEN_HANDLER2(slbfee_, "slbfee.", 0x1F, 0x13, 0x1E, 0x001F0000, PPC_SEGMENT_64B), #endif GEN_HANDLER(tlbia, 0x1F, 0x12, 0x0B, 0x03FFFC01, PPC_MEM_TLBIA), /* diff --git a/target/ppc/translate/storage-ctrl-impl.c.inc b/target/ppc/translate/storage-ctrl-impl.c.inc index f0854b137f..d7e2bb185f 100644 --- a/target/ppc/translate/storage-ctrl-impl.c.inc +++ b/target/ppc/translate/storage-ctrl-impl.c.inc @@ -107,6 +107,40 @@ static bool trans_SLBMFEE(DisasContext *ctx, arg_SLBMFEE *a) return true; } +static bool trans_SLBFEE(DisasContext *ctx, arg_SLBFEE *a) +{ + REQUIRE_64BIT(ctx); + REQUIRE_INSNS_FLAGS(ctx, SEGMENT_64B); + +#if defined(CONFIG_USER_ONLY) + gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); +#else + +#if defined(TARGET_PPC64) + TCGLabel *l1, *l2; + + if (unlikely(ctx->pr)) { + gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); + return true; + } + gen_helper_SLBFEE(cpu_gpr[a->rt], cpu_env, + cpu_gpr[a->rb]); + l1 = gen_new_label(); + l2 = gen_new_label(); + tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so); + tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[a->rt], -1, l1); + tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], CRF_EQ); + tcg_gen_br(l2); + gen_set_label(l1); + tcg_gen_movi_tl(cpu_gpr[a->rt], 0); + gen_set_label(l2); +#else + qemu_build_not_reached(); +#endif +#endif + return true; +} + static bool do_tlbie(DisasContext *ctx, arg_X_tlbie *a, bool local) { #if defined(CONFIG_USER_ONLY) From patchwork Mon Jul 18 17:22:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657637 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=B+3k8y25; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LmqPL0ryPz9sFr for ; Tue, 19 Jul 2022 03:55:18 +1000 (AEST) Received: from localhost ([::1]:37180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUxf-00055f-Uu for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:55:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSu-0008Tt-L9; Mon, 18 Jul 2022 13:23:34 -0400 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]:42505) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSr-0001uH-Jx; Mon, 18 Jul 2022 13:23:28 -0400 Received: by mail-ot1-x331.google.com with SMTP id k25-20020a056830169900b0061c6f68f451so9702467otr.9; Mon, 18 Jul 2022 10:23:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5Sgj+wP7my0Z/goW9hRxD8U0CXqln5HpAVJwAYRmxrE=; b=B+3k8y257GnuRszduSCoU7hjoWrHtzVK6Tp/fCzn0pco+D6H4gD1JGlN/goxPM0fAr UaSzV+Ywy7o7Jdeuywww4esXfjP4ebhu0bV7phuoKEj38g2+sNpgzMwSZ5qSCjbxFIWM jqU7tRvRoqtALp9jVYB7NMFr4yTDJDOQHnKay5+FkgCVhZz2M3CIqw2qz3IS6657YK0y tVEH81MMD1Cc3TxB1NvzT+kfvNo2cYc2U1Gr5roN661E7rc3UmMB6Qxk+WWL51yvGxVy /ouyDqZobb94FIKCiqvAY0BxTlj4OGtcDCCCWxuYAwH27X6eEedn39MRMb7YEA9keIXg 6inw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5Sgj+wP7my0Z/goW9hRxD8U0CXqln5HpAVJwAYRmxrE=; b=M9Y2OtaV1GaOhBj53k8HMAQebWdZ65dAIKduEDt8ZKRZPmesAQ2X3itra1d2Kl1jCK n+4nBq8ubwN3ZccOFSEyzKW7jBONI9OvnEZsIF90mfWiAK6vQ91ZMFHJPiLezZ7+BU+J mnigX8Cv0dZ4/EGTADaP7m+2FOCKoGQUum6kif7t9rOnDhOiyyUXCJfKzSSa32YJRXiX 6fR1uCCHKGdbYxQLEjoUZdsecFXjKhKjKpauESWh0ro2XkuKs8ScaLFJVTjqQ9xC4/yd rKNr8mSlGEHX0zcXX8mjC+pXhy6eh6TFrsNFtq2gS+rGl2lygMRh5Sc8sk4+C1KAcDiz TqSQ== X-Gm-Message-State: AJIora/bePoyiXmKMWiPcGdKYbHmGNSO8WjwuhWlD61prCjjJFQW9z7H p9CbyM2JsgxDbbU8/k7KsdIh7UzUOPw= X-Google-Smtp-Source: AGRyM1ufaiz/jIg6lxdlJ30NSTbWqa/J4G8Lj7PQZY0bipcdtC2f9ij1vP0ACs1C5WR+L9uy3h5U8A== X-Received: by 2002:a05:6830:61cd:b0:618:d560:b787 with SMTP id cc13-20020a05683061cd00b00618d560b787mr11946675otb.154.1658164995549; Mon, 18 Jul 2022 10:23:15 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.23.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:23:15 -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, Lucas Coutinho , Leandro Lupori Subject: [PULL 25/30] target/ppc: Move slbsync to decodetree Date: Mon, 18 Jul 2022 14:22:03 -0300 Message-Id: <20220718172208.1247624-26-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::331; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x331.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Lucas Coutinho Reviewed-by: Leandro Lupori Signed-off-by: Lucas Coutinho Message-Id: <20220701133507.740619-11-lucas.coutinho@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/insn32.decode | 2 ++ target/ppc/translate.c | 17 ----------------- target/ppc/translate/storage-ctrl-impl.c.inc | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index 5049c98691..781051e993 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -877,6 +877,8 @@ SLBMFEE 011111 ..... ----- ..... 1110010011 - @X_tb SLBFEE 011111 ..... ----- ..... 1111010011 1 @X_tb +SLBSYNC 011111 ----- ----- ----- 0101010010 - + ## TLB Management Instructions &X_tlbie rb rs ric prs:bool r:bool diff --git a/target/ppc/translate.c b/target/ppc/translate.c index d7a785164b..5a18ee577f 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -5388,20 +5388,6 @@ static void gen_tlbsync(DisasContext *ctx) #endif /* defined(CONFIG_USER_ONLY) */ } -#if defined(TARGET_PPC64) -/* slbsync */ -static void gen_slbsync(DisasContext *ctx) -{ -#if defined(CONFIG_USER_ONLY) - GEN_PRIV(ctx); -#else - CHK_SV(ctx); - gen_check_tlb_flush(ctx, true); -#endif /* defined(CONFIG_USER_ONLY) */ -} - -#endif /* defined(TARGET_PPC64) */ - /*** External control ***/ /* Optional: */ @@ -6787,9 +6773,6 @@ GEN_HANDLER(tlbia, 0x1F, 0x12, 0x0B, 0x03FFFC01, PPC_MEM_TLBIA), * different ISA versions */ GEN_HANDLER(tlbsync, 0x1F, 0x16, 0x11, 0x03FFF801, PPC_MEM_TLBSYNC), -#if defined(TARGET_PPC64) -GEN_HANDLER_E(slbsync, 0x1F, 0x12, 0x0A, 0x03FFF801, PPC_NONE, PPC2_ISA300), -#endif GEN_HANDLER(eciwx, 0x1F, 0x16, 0x0D, 0x00000001, PPC_EXTERN), GEN_HANDLER(ecowx, 0x1F, 0x16, 0x09, 0x00000001, PPC_EXTERN), GEN_HANDLER2(tlbld_6xx, "tlbld", 0x1F, 0x12, 0x1E, 0x03FF0001, PPC_6xx_TLB), diff --git a/target/ppc/translate/storage-ctrl-impl.c.inc b/target/ppc/translate/storage-ctrl-impl.c.inc index d7e2bb185f..5c569a3c75 100644 --- a/target/ppc/translate/storage-ctrl-impl.c.inc +++ b/target/ppc/translate/storage-ctrl-impl.c.inc @@ -141,6 +141,20 @@ static bool trans_SLBFEE(DisasContext *ctx, arg_SLBFEE *a) return true; } +static bool trans_SLBSYNC(DisasContext *ctx, arg_SLBSYNC *a) +{ + REQUIRE_64BIT(ctx); + REQUIRE_INSNS_FLAGS2(ctx, ISA300); + REQUIRE_SV(ctx); + +#if !defined(CONFIG_USER_ONLY) && defined(TARGET_PPC64) + gen_check_tlb_flush(ctx, true); +#else + qemu_build_not_reached(); +#endif + return true; +} + static bool do_tlbie(DisasContext *ctx, arg_X_tlbie *a, bool local) { #if defined(CONFIG_USER_ONLY) From patchwork Mon Jul 18 17:22:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657613 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=aq8VfX4a; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lmq0X237vz9sFr for ; Tue, 19 Jul 2022 03:37:16 +1000 (AEST) Received: from localhost ([::1]:57738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUgE-00035y-1a for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:37:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43792) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSw-0008Tw-0v; Mon, 18 Jul 2022 13:23:34 -0400 Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]:35468) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSt-0001tG-4J; Mon, 18 Jul 2022 13:23:29 -0400 Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-10cf9f5b500so24366028fac.2; Mon, 18 Jul 2022 10:23:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jAiDHDP0GXofu2nX9iLl0pMKtuYOAvJsdHqETrLkGDs=; b=aq8VfX4a8MGSxKCes2EhYbskYpeMGk9ex91qtBzQgNXb0CZRCg0dRLVovxiDEesomv OdePsJPxb21g677jw2DfYayhnOnFpqcQO8zw85Cplru2iv0eo1zkmLsfX5gmkV8GDj5i nQ953/fDzvnLo6Hd2FP+ym5opG5Pw0Io5OKziW4AcyC7bkrcOuvHPcZuz1+59woaTRLW 99EbXadNAxs4oVRwHrLqNq0GihHlHovArcqlrMp03TjPLCl/3xNYRIoL1LSjdSJ1y55r Xx0A2zxovoG65teO4NqnPqb8OzXla3c3snK+MbnFrU8dcBI9aZZbC3qikIZNiVoE7Rv8 afuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jAiDHDP0GXofu2nX9iLl0pMKtuYOAvJsdHqETrLkGDs=; b=IB0cmSdqlJu3XKPinxH6Icn5n8nqy8eV/ZaGMeiQ41iJl943hA6wOOSHiE1Tj834Zs 2aJr1ddCFUn9qCgb0TG+5WtniOvpR311+lIhdFUNpAgncyqF3d32WKbCVbACWBUkUTIM hMQAi96ijFW1yUjUDAuA2+TeV/z7kjCH47lyPm06Z0vlDKEsg3vh7nwZHVsSZ6M0cBIA l1fDQ5SqfSNhVtc1lDH5mT7t2Sqs0ZqToaZlmgX14rhl44ugKzrM5HoZeROlS9ftzB7G oz3t4kUo6QKh2ehC1Vv6ZOnknTAwirMaS9auSz6J8+nljzr5HCmcYte6m0gFeVnMuAWW QpkQ== X-Gm-Message-State: AJIora+HrXa8Sxx0iHOnwmJeDYCOTi8Bok+dqEBbth/p6yuRryNlEcOX 30u63S4D7voypfpqV6kj5uFsP9okcek= X-Google-Smtp-Source: AGRyM1vYP2iiQ5Yh6gx96RKzaUhTzYICXwChW262XNtF3c8TlWdNAGAbgH79gKEOqUUhEj3TkEGDFg== X-Received: by 2002:a05:6808:1b20:b0:33a:6c7a:d729 with SMTP id bx32-20020a0568081b2000b0033a6c7ad729mr4740971oib.299.1658164998026; Mon, 18 Jul 2022 10:23:18 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.23.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:23:17 -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, Lucas Coutinho , Leandro Lupori Subject: [PULL 26/30] target/ppc: Implement slbiag Date: Mon, 18 Jul 2022 14:22:04 -0300 Message-Id: <20220718172208.1247624-27-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::33; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x33.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Lucas Coutinho Reviewed-by: Leandro Lupori Signed-off-by: Lucas Coutinho Message-Id: <20220701133507.740619-12-lucas.coutinho@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/helper.h | 1 + target/ppc/insn32.decode | 4 +++ target/ppc/mmu-hash64.c | 27 ++++++++++++++++++++ target/ppc/translate/storage-ctrl-impl.c.inc | 14 ++++++++++ 4 files changed, 46 insertions(+) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index ef2dc30194..159b352f6e 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -681,6 +681,7 @@ DEF_HELPER_2(SLBMFEE, tl, env, tl) DEF_HELPER_2(SLBMFEV, tl, env, tl) DEF_HELPER_2(SLBFEE, tl, env, tl) DEF_HELPER_FLAGS_2(SLBIA, TCG_CALL_NO_RWG, void, env, i32) +DEF_HELPER_FLAGS_3(SLBIAG, TCG_CALL_NO_RWG, void, env, tl, i32) DEF_HELPER_FLAGS_2(SLBIE, TCG_CALL_NO_RWG, void, env, tl) DEF_HELPER_FLAGS_2(SLBIEG, TCG_CALL_NO_RWG, void, env, tl) #endif diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode index 781051e993..eb41efc100 100644 --- a/target/ppc/insn32.decode +++ b/target/ppc/insn32.decode @@ -152,6 +152,9 @@ &X_rb rb @X_rb ...... ..... ..... rb:5 .......... . &X_rb +&X_rs_l rs l:bool +@X_rs_l ...... rs:5 .... l:1 ..... .......... . &X_rs_l + &X_uim5 xt uim:uint8_t @X_uim5 ...... ..... ..... uim:5 .......... . &X_uim5 xt=%x_xt @@ -869,6 +872,7 @@ SLBIE 011111 ----- ----- ..... 0110110010 - @X_rb SLBIEG 011111 ..... ----- ..... 0111010010 - @X_tb SLBIA 011111 --... ----- ----- 0111110010 - @X_ih +SLBIAG 011111 ..... ----. ----- 1101010010 - @X_rs_l SLBMTE 011111 ..... ----- ..... 0110010010 - @X_tb diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c index 7ec7a67a78..b9b31fd276 100644 --- a/target/ppc/mmu-hash64.c +++ b/target/ppc/mmu-hash64.c @@ -173,6 +173,33 @@ void helper_SLBIA(CPUPPCState *env, uint32_t ih) } } +#if defined(TARGET_PPC64) +void helper_SLBIAG(CPUPPCState *env, target_ulong rs, uint32_t l) +{ + PowerPCCPU *cpu = env_archcpu(env); + int n; + + /* + * slbiag must always flush all TLB (which is equivalent to ERAT in ppc + * architecture). Matching on SLB_ESID_V is not good enough, because slbmte + * can overwrite a valid SLB without flushing its lookaside information. + * + * It would be possible to keep the TLB in synch with the SLB by flushing + * when a valid entry is overwritten by slbmte, and therefore slbiag would + * not have to flush unless it evicts a valid SLB entry. However it is + * expected that slbmte is more common than slbiag, and slbiag is usually + * going to evict valid SLB entries, so that tradeoff is unlikely to be a + * good one. + */ + env->tlb_need_flush |= TLB_NEED_LOCAL_FLUSH; + + for (n = 0; n < cpu->hash64_opts->slb_size; n++) { + ppc_slb_t *slb = &env->slb[n]; + slb->esid &= ~SLB_ESID_V; + } +} +#endif + static void __helper_slbie(CPUPPCState *env, target_ulong addr, target_ulong global) { diff --git a/target/ppc/translate/storage-ctrl-impl.c.inc b/target/ppc/translate/storage-ctrl-impl.c.inc index 5c569a3c75..6ea1d22ef9 100644 --- a/target/ppc/translate/storage-ctrl-impl.c.inc +++ b/target/ppc/translate/storage-ctrl-impl.c.inc @@ -65,6 +65,20 @@ static bool trans_SLBIA(DisasContext *ctx, arg_SLBIA *a) return true; } +static bool trans_SLBIAG(DisasContext *ctx, arg_SLBIAG *a) +{ + REQUIRE_64BIT(ctx); + REQUIRE_INSNS_FLAGS2(ctx, ISA300); + REQUIRE_SV(ctx); + +#if !defined(CONFIG_USER_ONLY) && defined(TARGET_PPC64) + gen_helper_SLBIAG(cpu_env, cpu_gpr[a->rs], tcg_constant_i32(a->l)); +#else + qemu_build_not_reached(); +#endif + return true; +} + static bool trans_SLBMTE(DisasContext *ctx, arg_SLBMTE *a) { REQUIRE_64BIT(ctx); From patchwork Mon Jul 18 17:22:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657651 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=YGoqzb4x; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LmqW469dvz9s2R for ; Tue, 19 Jul 2022 04:00:16 +1000 (AEST) Received: from localhost ([::1]:51144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDV2U-0006HG-O3 for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 14:00:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43830) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSx-0008Ug-Mz; Mon, 18 Jul 2022 13:23:37 -0400 Received: from mail-oa1-x2f.google.com ([2001:4860:4864:20::2f]:40589) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSt-0001uO-4l; Mon, 18 Jul 2022 13:23:31 -0400 Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-10c0e6dd55eso25485738fac.7; Mon, 18 Jul 2022 10:23:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8MxUulcexnbMlS+fESNVtXDUXSNPrPKDymk+wPWckEk=; b=YGoqzb4xGnb6G6+BwLbCPSm7jcGRa8SN+7oSVP082SFaSfgRK2ZCsh97S6TXa4KXMl Jo9jpj7c2SKIMVqN0Hj7T/CTGcYWew93sPnV4Vvt9RHTvzGD6xBBJhRaqj+qtUcFOrkP jDT6QqTwO0dXdIyHNZz7I3nhMbM3C5ywcgg8Z70DMPBI95kAu+9hr6SCPNvD4DTI1eVw zJRxTPSyGLgGm1ySQhXi8FqplP7V6tmDtVezVHk1iQ1nU4lFNG7sYDIIZwFadLGvYqOj W8k42QFN+9maSXk2+tKW2vCJmQ6aqLJ+0UxRyO3b7FGA5iFEcO0QPULHE/6Nw2Wu8fNr v9WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8MxUulcexnbMlS+fESNVtXDUXSNPrPKDymk+wPWckEk=; b=fysgv7UFE5Cn9ERoNQhQJs3+oY+sTRkGl1xQ7nYCFtNU3AjE9Ug4U8kdVKA1WsxAVy UckHcCqHKhWVVHx9p9BmmbYJGQ3jh2j9N4Mqw0hoPCFwcdUae3HX++2bmf1tDNMt3WcK 2ZL9X7nFlUMLzH0jjYcIyZPQv6YQ5DYA0UWgEFX9G7ZVyNrwzdzWfU7sIBoekCcNAhCV 4jGk+n4TQwv/+1QQ127Fjbd+SaqFrw/VJrLn+r19lmesPCPdGitydKuqXysDYgRXZ1m/ CnnJxhTxQkRP2EBwi8cBAtJYJvmgtO5OOpyxlWIlEhzoZTwoFWaxmQUoU1rW65rm6B3N 9wvQ== X-Gm-Message-State: AJIora8MaLoGFMaHpA9qLxZU9DtuhxubTj3ReuLUylr42i8OQjF4mqrE okMOzWLvfNytxRYp4+SeD5ib01jg1SI= X-Google-Smtp-Source: AGRyM1u5ElVPWvKkybOmnUUgAk8x2K2SmcfYEhDYP5MMr5YTLIxtFGLcQsg4Y/5f+xDoQlbLvFRj0Q== X-Received: by 2002:a05:6808:152a:b0:335:4be5:612f with SMTP id u42-20020a056808152a00b003354be5612fmr14200071oiw.254.1658165000538; Mon, 18 Jul 2022 10:23:20 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.23.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:23:19 -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, Matheus Ferst Subject: [PULL 27/30] target/ppc: check tb_env != 0 before printing TBU/TBL/DECR Date: Mon, 18 Jul 2022 14:22:05 -0300 Message-Id: <20220718172208.1247624-28-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2f; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x2f.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Matheus Ferst When using "-machine none", env->tb_env is not allocated, causing the segmentation fault reported in issue #85 (launchpad bug #811683). To avoid this problem, check if the pointer != NULL before calling the methods to print TBU/TBL/DECR. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/85 Signed-off-by: Matheus Ferst Reviewed-by: Daniel Henrique Barboza Message-Id: <20220714172343.80539-1-matheus.ferst@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/cpu_init.c | 18 ++++++++---------- target/ppc/monitor.c | 9 +++++++++ 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 4f2355e941..d1493a660c 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7471,17 +7471,15 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, int flags) "%08x iidx %d didx %d\n", env->msr, env->spr[SPR_HID0], env->hflags, cpu_mmu_index(env, true), cpu_mmu_index(env, false)); -#if !defined(NO_TIMER_DUMP) - qemu_fprintf(f, "TB %08" PRIu32 " %08" PRIu64 #if !defined(CONFIG_USER_ONLY) - " DECR " TARGET_FMT_lu -#endif - "\n", - cpu_ppc_load_tbu(env), cpu_ppc_load_tbl(env) -#if !defined(CONFIG_USER_ONLY) - , cpu_ppc_load_decr(env) -#endif - ); + if (env->tb_env) { + qemu_fprintf(f, "TB %08" PRIu32 " %08" PRIu64 + " DECR " TARGET_FMT_lu "\n", cpu_ppc_load_tbu(env), + cpu_ppc_load_tbl(env), cpu_ppc_load_decr(env)); + } +#else + qemu_fprintf(f, "TB %08" PRIu32 " %08" PRIu64 "\n", cpu_ppc_load_tbu(env), + cpu_ppc_load_tbl(env)); #endif for (i = 0; i < 32; i++) { if ((i & (RGPL - 1)) == 0) { diff --git a/target/ppc/monitor.c b/target/ppc/monitor.c index 0b805ef6e9..8250b1304e 100644 --- a/target/ppc/monitor.c +++ b/target/ppc/monitor.c @@ -55,6 +55,9 @@ static target_long monitor_get_decr(Monitor *mon, const struct MonitorDef *md, int val) { CPUArchState *env = mon_get_cpu_env(mon); + if (!env->tb_env) { + return 0; + } return cpu_ppc_load_decr(env); } @@ -62,6 +65,9 @@ static target_long monitor_get_tbu(Monitor *mon, const struct MonitorDef *md, int val) { CPUArchState *env = mon_get_cpu_env(mon); + if (!env->tb_env) { + return 0; + } return cpu_ppc_load_tbu(env); } @@ -69,6 +75,9 @@ static target_long monitor_get_tbl(Monitor *mon, const struct MonitorDef *md, int val) { CPUArchState *env = mon_get_cpu_env(mon); + if (!env->tb_env) { + return 0; + } return cpu_ppc_load_tbl(env); } From patchwork Mon Jul 18 17:22:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657646 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=niaFNhAz; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LmqTf4NbNz9s2R for ; Tue, 19 Jul 2022 03:59:02 +1000 (AEST) Received: from localhost ([::1]:46772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDV1I-0003KT-Fz for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:59:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUT0-0008VV-GN; Mon, 18 Jul 2022 13:23:37 -0400 Received: from mail-oa1-x32.google.com ([2001:4860:4864:20::32]:45662) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSt-0001ub-5K; Mon, 18 Jul 2022 13:23:34 -0400 Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-10c0052da61so25494211fac.12; Mon, 18 Jul 2022 10:23:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OFZ7zolXvpaOlznryERlV7wLXBqQGgiB5FyUAm/2fkQ=; b=niaFNhAzkAX/HTk5zTcxouWXXy/Ij6vakW+e0fvoCGSZEVQOdpM829b48eGMvGnLGR olJwv6nYdsFR2mF98+5p0RDWhZBSs7kPZqDE5PnIShuDm8B0yNRzfXxbL9++B+jxNJTA pD/ZwaaW9ZD+lk+tUBsPfU0AstE/Ay1+vT80zC9kvfBzPfdiZfbMMAgrnNNk9kl/MDX7 ilCT17KiT1d7bOVBo3IvFe7KLIz7TqcTEEdVfkj0gathHSjZzJg1Nu2TLW9FTYnmRzrb Oqyw2iMvXUu47tNG3si38+SShaNB29jBAdPz3XGP1y65m4KE06YEvwjHVGLos5meoZLQ P8DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OFZ7zolXvpaOlznryERlV7wLXBqQGgiB5FyUAm/2fkQ=; b=Y8AIme/kuk3G9xgJ3lfCO/zADFR4wPtlSd1NsKCETYWI1Kfiz6H5uLsxayJo43rWYG Urb66KWXiMh1WVi0UisBZL3Zsa7MH6tL7GUqevdCjnKiME9gayfTIjxNkHsL7RDZqre3 EuYIQw9zLMCB7XEomG4rMNV4K0dC8IzVOG2K8PQwcj59ZUwyzxOnj2D6sJjjcl6T6qaK AQdSR+pcsls7V82Hudf01oS4/OM63AZOizHjyev0E5MaR/wcdLi+m3b61y1XFIrGe+RQ WdgATGwMRZX67FcHEWwbBdg1c2Yxd+ytpzDpCRXuxae4Fi4uZ4GftVPqGZvKRZP7c3nk 2CWw== X-Gm-Message-State: AJIora9GWU+qpWsSpNePEijabn8XSPOQe8E+LP77wUil0sIwtCulxnKP adNGSu5yqdvBbuj/ndQ3h85VAtlx7oM= X-Google-Smtp-Source: AGRyM1vbeQ2qqNIhGV+H38bsV/CgFAkOncX9z9vDgbZ+GvMjpoxJd8PaUISVr8i33HkUUY/N0J8M5Q== X-Received: by 2002:a05:6870:65ab:b0:10c:373d:eca8 with SMTP id fp43-20020a05687065ab00b0010c373deca8mr15991357oab.187.1658165003132; Mon, 18 Jul 2022 10:23:23 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.23.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:23:22 -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, Leandro Lupori , Fabiano Rosas Subject: [PULL 28/30] ppc: Check partition and process table alignment Date: Mon, 18 Jul 2022 14:22:06 -0300 Message-Id: <20220718172208.1247624-29-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::32; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x32.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Leandro Lupori Check if partition and process tables are properly aligned, in their size, according to PowerISA 3.1B, Book III 6.7.6 programming note. Hardware and KVM also raise an exception in these cases. Signed-off-by: Leandro Lupori Reviewed-by: Fabiano Rosas Message-Id: <20220628133959.15131-2-leandro.lupori@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr.c | 5 +++++ hw/ppc/spapr_hcall.c | 9 +++++++++ target/ppc/mmu-book3s-v3.c | 5 +++++ target/ppc/mmu-radix64.c | 17 +++++++++++++---- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 3a5112899e..bc9ba6e6dc 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1336,6 +1336,11 @@ static bool spapr_get_pate(PPCVirtualHypervisor *vhyp, PowerPCCPU *cpu, patb = spapr->nested_ptcr & PTCR_PATB; pats = spapr->nested_ptcr & PTCR_PATS; + /* Check if partition table is properly aligned */ + if (patb & MAKE_64BIT_MASK(0, pats + 12)) { + return false; + } + /* Calculate number of entries */ pats = 1ull << (pats + 12 - 4); if (pats <= lpid) { diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index d761a7d0c3..a8d4a6bcf0 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -920,6 +920,7 @@ static target_ulong h_register_process_table(PowerPCCPU *cpu, target_ulong page_size = args[2]; target_ulong table_size = args[3]; target_ulong update_lpcr = 0; + target_ulong table_byte_size; uint64_t cproc; if (flags & ~FLAGS_MASK) { /* Check no reserved bits are set */ @@ -927,6 +928,14 @@ static target_ulong h_register_process_table(PowerPCCPU *cpu, } if (flags & FLAG_MODIFY) { if (flags & FLAG_REGISTER) { + /* Check process table alignment */ + table_byte_size = 1ULL << (table_size + 12); + if (proc_tbl & (table_byte_size - 1)) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: process table not properly aligned: proc_tbl 0x" + TARGET_FMT_lx" proc_tbl_size 0x"TARGET_FMT_lx"\n", + __func__, proc_tbl, table_byte_size); + } if (flags & FLAG_RADIX) { /* Register new RADIX process table */ if (proc_tbl & 0xfff || proc_tbl >> 60) { return H_P2; diff --git a/target/ppc/mmu-book3s-v3.c b/target/ppc/mmu-book3s-v3.c index f4985bae78..c8f69b3df9 100644 --- a/target/ppc/mmu-book3s-v3.c +++ b/target/ppc/mmu-book3s-v3.c @@ -28,6 +28,11 @@ bool ppc64_v3_get_pate(PowerPCCPU *cpu, target_ulong lpid, ppc_v3_pate_t *entry) uint64_t patb = cpu->env.spr[SPR_PTCR] & PTCR_PATB; uint64_t pats = cpu->env.spr[SPR_PTCR] & PTCR_PATS; + /* Check if partition table is properly aligned */ + if (patb & MAKE_64BIT_MASK(0, pats + 12)) { + return false; + } + /* Calculate number of entries */ pats = 1ull << (pats + 12 - 4); if (pats <= lpid) { diff --git a/target/ppc/mmu-radix64.c b/target/ppc/mmu-radix64.c index 21ac958e48..9a8a2e2875 100644 --- a/target/ppc/mmu-radix64.c +++ b/target/ppc/mmu-radix64.c @@ -383,7 +383,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu, { CPUState *cs = CPU(cpu); CPUPPCState *env = &cpu->env; - uint64_t offset, size, prtbe_addr, prtbe0, base_addr, nls, index, pte; + uint64_t offset, size, prtb, prtbe_addr, prtbe0, base_addr, nls, index, pte; int fault_cause = 0, h_page_size, h_prot; hwaddr h_raddr, pte_addr; int ret; @@ -393,9 +393,18 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu, __func__, access_str(access_type), eaddr, mmu_idx, pid); + prtb = (pate.dw1 & PATE1_R_PRTB); + size = 1ULL << ((pate.dw1 & PATE1_R_PRTS) + 12); + if (prtb & (size - 1)) { + /* Process Table not properly aligned */ + if (guest_visible) { + ppc_radix64_raise_si(cpu, access_type, eaddr, DSISR_R_BADCONFIG); + } + return 1; + } + /* Index Process Table by PID to Find Corresponding Process Table Entry */ offset = pid * sizeof(struct prtb_entry); - size = 1ULL << ((pate.dw1 & PATE1_R_PRTS) + 12); if (offset >= size) { /* offset exceeds size of the process table */ if (guest_visible) { @@ -403,7 +412,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu, } return 1; } - prtbe_addr = (pate.dw1 & PATE1_R_PRTB) + offset; + prtbe_addr = prtb + offset; if (vhyp_flat_addressing(cpu)) { prtbe0 = ldq_phys(cs->as, prtbe_addr); @@ -568,7 +577,7 @@ static bool ppc_radix64_xlate_impl(PowerPCCPU *cpu, vaddr eaddr, return false; } - /* Get Process Table */ + /* Get Partition Table */ if (cpu->vhyp) { PPCVirtualHypervisorClass *vhc; vhc = PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp); From patchwork Mon Jul 18 17:22:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657620 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=b3A7Flwt; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lmq5m375pz9sFr for ; Tue, 19 Jul 2022 03:41:48 +1000 (AEST) Received: from localhost ([::1]:37856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDUkc-0000xC-7z for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:41:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSx-0008Uf-LX; Mon, 18 Jul 2022 13:23:37 -0400 Received: from mail-oa1-x31.google.com ([2001:4860:4864:20::31]:36848) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSt-0001vu-8v; Mon, 18 Jul 2022 13:23:31 -0400 Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-10bf634bc50so25536826fac.3; Mon, 18 Jul 2022 10:23:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xy/J6nDx5Rdq3r1yCxku7h1hliPNBu1FJJ1iHHYlgkQ=; b=b3A7Flwtza3tKS0x50HkXl7r/6hJKZvCmKlclGxhzTqLmkhkw+6U2QRuI6QTjRKfdC 1msm84EPlFGzab+YZFCNE2D7eliZ+r18vH9L/9n3e1w3c82pos0G+1S6zT2jWsjhpba8 3BT4y9af05XcyGhHj7LcLnaIxWY6vDErt5wfrb0UKtGgYm2na31Wf6k5V0ZvYjUTLk73 +RdmP8tgxD/aL5FwTh4NxhinK9JTWGLlAnlvumxCHlYOVqWRxWIhhm7zWcIkCisp0wCI WDjesPq8zRUof00K4Z8ZccFPbD2QhCxeNoyHDxBZ0PDB4GbyD8LyK/Rnfe7Z/9sVyrle +ceA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xy/J6nDx5Rdq3r1yCxku7h1hliPNBu1FJJ1iHHYlgkQ=; b=nPIfRKLFodVl5Iyrz/2eQ6bEJ85WP1KZBLdQP9bQ4pS7GyNPCjnoiUIm7D/7c+dz7m VQtaJ9WuR2h+FuGRQJqwdrcwQk5gFV3GVBQGu6R9+4vXkofL/T+guAVI5RQ0jdWpFtTq LzEzwRt4sYv3ww2ifd2tI3dKU5O7pq9SIloHUboPYkbU0X19/rfgVekJ3tf0fpkx0jWJ I2tqRnaPa1qr6u8DYlKMnqYTZ62+1mvo5jXoc/ii+EPcxunNOdZEUbWhIR2blt7P9cFZ Xz+72uVNybbnZWrkwxMAn5wBnt6z/T5t8iRD8mS0nEk9fNtjUrkMemPixrFw8vtQMvW1 a28w== X-Gm-Message-State: AJIora+09cjYy4o7K33ocXxNG7sJaKD0zm0F+X12nBwfTZtLuc+jFlXM a/FLPytb78dDVZv1CHxmS5bQO7piDic= X-Google-Smtp-Source: AGRyM1smewgqLSJihisg9b27pqt61B27gZq0dwIeyT3NVa6tvUhNos6pM4NCPQz7YFuYlzPC/aqI7w== X-Received: by 2002:a05:6870:d1cc:b0:100:e9ba:f14b with SMTP id b12-20020a056870d1cc00b00100e9baf14bmr17568595oac.256.1658165005740; Mon, 18 Jul 2022 10:23:25 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.23.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:23:25 -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, Leandro Lupori , Fabiano Rosas Subject: [PULL 29/30] target/ppc: Improve Radix xlate level validation Date: Mon, 18 Jul 2022 14:22:07 -0300 Message-Id: <20220718172208.1247624-30-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::31; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x31.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Leandro Lupori Check if the number and size of Radix levels are valid on POWER9/POWER10 CPUs, according to the supported Radix Tree Configurations described in their User Manuals. Signed-off-by: Leandro Lupori Reviewed-by: Fabiano Rosas Message-Id: <20220628133959.15131-3-leandro.lupori@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/mmu-radix64.c | 49 +++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/target/ppc/mmu-radix64.c b/target/ppc/mmu-radix64.c index 9a8a2e2875..705bff76be 100644 --- a/target/ppc/mmu-radix64.c +++ b/target/ppc/mmu-radix64.c @@ -236,17 +236,37 @@ static void ppc_radix64_set_rc(PowerPCCPU *cpu, MMUAccessType access_type, } } +static bool ppc_radix64_is_valid_level(int level, int psize, uint64_t nls) +{ + /* + * Check if this is a valid level, according to POWER9 and POWER10 + * Processor User's Manuals, sections 4.10.4.1 and 5.10.6.1, respectively: + * Supported Radix Tree Configurations and Resulting Page Sizes. + * + * Note: these checks are specific to POWER9 and POWER10 CPUs. Any future + * CPUs that supports a different Radix MMU configuration will need their + * own implementation. + */ + switch (level) { + case 0: /* Root Page Dir */ + return psize == 52 && nls == 13; + case 1: + case 2: + return nls == 9; + case 3: + return nls == 9 || nls == 5; + default: + qemu_log_mask(LOG_GUEST_ERROR, "invalid radix level: %d\n", level); + return false; + } +} + static int ppc_radix64_next_level(AddressSpace *as, vaddr eaddr, uint64_t *pte_addr, uint64_t *nls, int *psize, uint64_t *pte, int *fault_cause) { uint64_t index, pde; - if (*nls < 5) { /* Directory maps less than 2**5 entries */ - *fault_cause |= DSISR_R_BADCONFIG; - return 1; - } - /* Read page entry from guest address space */ pde = ldq_phys(as, *pte_addr); if (!(pde & R_PTE_VALID)) { /* Invalid Entry */ @@ -270,12 +290,8 @@ static int ppc_radix64_walk_tree(AddressSpace *as, vaddr eaddr, hwaddr *raddr, int *psize, uint64_t *pte, int *fault_cause, hwaddr *pte_addr) { - uint64_t index, pde, rpn , mask; - - if (nls < 5) { /* Directory maps less than 2**5 entries */ - *fault_cause |= DSISR_R_BADCONFIG; - return 1; - } + uint64_t index, pde, rpn, mask; + int level = 0; index = eaddr >> (*psize - nls); /* Shift */ index &= ((1UL << nls) - 1); /* Mask */ @@ -283,6 +299,11 @@ static int ppc_radix64_walk_tree(AddressSpace *as, vaddr eaddr, do { int ret; + if (!ppc_radix64_is_valid_level(level++, *psize, nls)) { + *fault_cause |= DSISR_R_BADCONFIG; + return 1; + } + ret = ppc_radix64_next_level(as, eaddr, pte_addr, &nls, psize, &pde, fault_cause); if (ret) { @@ -456,6 +477,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu, } } else { uint64_t rpn, mask; + int level = 0; index = (eaddr & R_EADDR_MASK) >> (*g_page_size - nls); /* Shift */ index &= ((1UL << nls) - 1); /* Mask */ @@ -475,6 +497,11 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu, return ret; } + if (!ppc_radix64_is_valid_level(level++, *g_page_size, nls)) { + fault_cause |= DSISR_R_BADCONFIG; + return 1; + } + ret = ppc_radix64_next_level(cs->as, eaddr & R_EADDR_MASK, &h_raddr, &nls, g_page_size, &pte, &fault_cause); if (ret) { From patchwork Mon Jul 18 17:22:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1657645 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=fGLuLdzU; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LmqSs19VPz9s2R for ; Tue, 19 Jul 2022 03:58:21 +1000 (AEST) Received: from localhost ([::1]:44602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDV0d-0001sL-1E for incoming@patchwork.ozlabs.org; Mon, 18 Jul 2022 13:58:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDUSy-0008Uk-HQ; Mon, 18 Jul 2022 13:23:37 -0400 Received: from mail-oa1-x31.google.com ([2001:4860:4864:20::31]:36849) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDUSv-0001wL-Cn; Mon, 18 Jul 2022 13:23:31 -0400 Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-10bf634bc50so25537126fac.3; Mon, 18 Jul 2022 10:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CVZsAAdtYcsgWFrSALuPq9KJRP+za2YV6sjUCR9hDVc=; b=fGLuLdzU9A7JdTaGuWrLhujRMw/D4WS5I2b8WmD/y4ARUMjCcZ9dQA3viNi56Way0w T+/PyjSntO8pNjjiwoCAtREnPphhQhnECV8I9q+XSEnPNlK8Zfx42TutB7UEIteHGpKP YU4YJkxq7eyXZPjTaJjbB+jTW2eN0ERA4mAtjjU63Rzj4gpqIhfOxMKhaoIt64JOXrGm cQJBgzdmPG6eCKQQzD2deAzJGMsm7OqMf/Hw1YUjoCvICIiibUebHbDVC5jZhb1iOBqF uuRoPfEOqsp4AbCWmRK1/7f1DaWWFkozMt+x4pkEgvfiAo5PwpCkVGCabQUT4LTRL3GU St+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CVZsAAdtYcsgWFrSALuPq9KJRP+za2YV6sjUCR9hDVc=; b=rz6p+9Hc5fri4prMT1EaEUIdrPEnlEx878TUfRfsNOcZ90syTyMTGmYoKnuqgo4dkv jAJAkCoA8zz4zstkoVMI1cS++qOd3pMeatXTwvljrCZXyrLq1EELy+k3DWQzhGRUt3IG xXsaPvfN2iZhSb7LDP7qf633BJmN9I0c9rxUnsKsLt0Tq/AEgRykZcAjMwao5YC/zDok 7W5kaC2O/fqA6AUCUT92Hk0Ym0MDnAOlRxDsAnQz3NJbLrRrNvcvfMUXwss5lMw8VFiH zm9/vxCazATUbMi7WHFzeX33Rp8/lnPMnX0xL4ZFhx7IlPU6SmiAy4FCPRIEn2yEExmz pBhw== X-Gm-Message-State: AJIora+XdJxOi/UKPpceYYZtO/tGU/kYk7Ttt8rIPPxG5I3sD6Vw2ZPh FCPMF1eZZCQaaCb0KW6auHY6ZcOd2+w= X-Google-Smtp-Source: AGRyM1u+LBs0rW55JICThUiFCAb4D99bDakx7wiVkruW5NgKYQ22KqJbwrz1AW3gvDLig1aXvKZT6A== X-Received: by 2002:a05:6870:e615:b0:100:bbc4:ac92 with SMTP id q21-20020a056870e61500b00100bbc4ac92mr17573156oag.211.1658165007987; Mon, 18 Jul 2022 10:23:27 -0700 (PDT) Received: from balboa.ibmmodules.com (201-27-97-88.dsl.telesp.net.br. [201.27.97.88]) by smtp.gmail.com with ESMTPSA id j27-20020a056870169b00b0010c33621645sm6523856oae.55.2022.07.18.10.23.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 10:23:27 -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, Leandro Lupori Subject: [PULL 30/30] target/ppc: Check page dir/table base alignment Date: Mon, 18 Jul 2022 14:22:08 -0300 Message-Id: <20220718172208.1247624-31-danielhb413@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com> References: <20220718172208.1247624-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::31; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x31.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Leandro Lupori According to PowerISA 3.1B, Book III 6.7.6 programming note, the page directory base addresses are expected to be aligned to their size. Real hardware seems to rely on that and will access the wrong address if they are misaligned. This results in a translation failure even if the page tables seem to be properly populated. Signed-off-by: Leandro Lupori Reviewed-by: Daniel Henrique Barboza Message-Id: <20220628133959.15131-4-leandro.lupori@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza --- target/ppc/mmu-radix64.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/target/ppc/mmu-radix64.c b/target/ppc/mmu-radix64.c index 705bff76be..00f2e9fa2e 100644 --- a/target/ppc/mmu-radix64.c +++ b/target/ppc/mmu-radix64.c @@ -265,7 +265,7 @@ static int ppc_radix64_next_level(AddressSpace *as, vaddr eaddr, uint64_t *pte_addr, uint64_t *nls, int *psize, uint64_t *pte, int *fault_cause) { - uint64_t index, pde; + uint64_t index, mask, nlb, pde; /* Read page entry from guest address space */ pde = ldq_phys(as, *pte_addr); @@ -280,7 +280,17 @@ static int ppc_radix64_next_level(AddressSpace *as, vaddr eaddr, *nls = pde & R_PDE_NLS; index = eaddr >> (*psize - *nls); /* Shift */ index &= ((1UL << *nls) - 1); /* Mask */ - *pte_addr = (pde & R_PDE_NLB) + (index * sizeof(pde)); + nlb = pde & R_PDE_NLB; + mask = MAKE_64BIT_MASK(0, *nls + 3); + + if (nlb & mask) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: misaligned page dir/table base: 0x"TARGET_FMT_lx + " page dir size: 0x"TARGET_FMT_lx"\n", + __func__, nlb, mask + 1); + nlb &= ~mask; + } + *pte_addr = nlb + index * sizeof(pde); } return 0; } @@ -294,8 +304,18 @@ static int ppc_radix64_walk_tree(AddressSpace *as, vaddr eaddr, int level = 0; index = eaddr >> (*psize - nls); /* Shift */ - index &= ((1UL << nls) - 1); /* Mask */ - *pte_addr = base_addr + (index * sizeof(pde)); + index &= ((1UL << nls) - 1); /* Mask */ + mask = MAKE_64BIT_MASK(0, nls + 3); + + if (base_addr & mask) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: misaligned page dir base: 0x"TARGET_FMT_lx + " page dir size: 0x"TARGET_FMT_lx"\n", + __func__, base_addr, mask + 1); + base_addr &= ~mask; + } + *pte_addr = base_addr + index * sizeof(pde); + do { int ret;