From patchwork Wed Oct 9 00:04:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 833836 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp556829wrv; Tue, 8 Oct 2024 17:09:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCURF8gCGbTBaJ+T+JZvyl11d7WfbeWHBJFuq7NSEh3c4x3DS2gQGCf/IBDnIh2okaNJpaINSA==@linaro.org X-Google-Smtp-Source: AGHT+IEooTbEGDGs5+B8X2MQSVjR5gbrI48XLto7eQyEGT/5n112CycAxhZIduAcModHPuK70fvx X-Received: by 2002:a05:620a:4452:b0:7ac:bfb6:8202 with SMTP id af79cd13be357-7b07954fd55mr119241885a.38.1728432545683; Tue, 08 Oct 2024 17:09:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728432545; cv=none; d=google.com; s=arc-20240605; b=O/AV5xPJjyL7M8OjV8kzldVtqAeA4fYqURJ8BLat2zEXF4NxpglRCYFmATjwOIOQMQ dRLsRZVO4gHorHcrl90/084MwadYOMJHh0O4+yeTYC4YvQ9gz/sYAOqvD55H5YXSKfXO fWWnV0Q4v+/3+IlYi82oaWlo/3+IMK2urGCdsxLypLwelECO/012BlWVwbp7aIQtPK/P qogtUiGwyDQxK7Ikd9MYtLDFiufAdQUyOr3go0DMMJh5D0t/ugbgyLWFT8eAw2tqRpja GPOdgoC8u/k6rTD5XRptQF3ah0DBvBMKkVB0lc2yRjDbQfwTBLcVUelCVOEHOG99tv0B zeaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iV2KSUuCTdEDpKpG+VIBV8pupsJQOA9ecDi8J+rVd34=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=kMJ631w3SZ0WGfuJ1lo+ESv/C3DEh58oXsYvXxoysiBIg+Iwa7DWSyUn5hNnSr8dQi IUEDwKBVWmGIGilbAfUgtcZRTjfQSjXaIsDHjtZQCajuvr/RXjn53+qAD+Zn7qusRc7V LGEPR5roSuo+Fqnhm7rOk05ZmhXO38JpO+4MXHik9mYt5KtMX8PPIbqGB/ackyuQs8Yv pj4J2C1RHuswVc49+2Hdyj6Xv0WTJ3CmJhamrlraLs15k3RBXah4UeE9YP7UrP1oT00B T+qcP9wxLUnBNbCaDpSRl33YM+2idKSEdb9gDSymCoFky+tjA8bnK0ayAyfy0qL7EsqZ P7vA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J3aKb9Iy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7afb0b81312si287712185a.339.2024.10.08.17.09.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 17:09:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J3aKb9Iy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCd-0004UT-6E; Tue, 08 Oct 2024 20:05:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syKCT-0004Lw-Uc for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:09 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCR-0002sl-DA for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:09 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-20c544d34bcso12092885ad.1 for ; Tue, 08 Oct 2024 17:05:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432306; x=1729037106; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iV2KSUuCTdEDpKpG+VIBV8pupsJQOA9ecDi8J+rVd34=; b=J3aKb9Iyi691KWz01n8GgVdmpzlRcXM+e6yLl6g0beKQjo1nTAtVTe/0+a35GJUV7Q SFilfrH2Zgee4yBpV2DCNnAnf7Oc7677fnPC+I4lIUh3t50zIMa2q3Td460VsSJj/ON9 ZWNSBDB8X522LESZ20qnC6ouWpygRC+7j5sUtTmBBjP+hZ/GNIJF6slptyDQD17BHDFJ XWSoktcTWTmuDcfGPfwhKXZaLkZgy7rITynmGeCSl1rO18X42xfHQj0Obv6fB2b0Pm69 erTUU5jfuFDeW6CPH1ykzZ3bDmarPbqeLLAimIT8UV1Qtic4SI2RGTAxv1h6K53CH1Lb Io3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432306; x=1729037106; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iV2KSUuCTdEDpKpG+VIBV8pupsJQOA9ecDi8J+rVd34=; b=roBYGVDvoqTyz0J7fPSoBIXyUS3NT75DwRNKaRu4J2SkHsbxEv2Z+L4crx7Mjzf0NL glLT9XuEa79uu2RbmTnFLbiTcRCxXakyBXKP/TQOYYGYVSOygVRVHCEA5WWXAIyioEdR PnZahY/xL/SRHjWZ7hX3wZSJwTDqfKCF0C8IsJScdNM4ajROckoEydSjHV91jDeOh9CP I58QWi7D1ZaVuiy6bzGiM/IYC2hqG5/ggcMIuKwK8LM9LupZVlgKfUUCyEDnAL353Rau NCXTnzpOrPzq3ZhXvJojxgjOQmSzJxOyhoO79MIi0LoSrKWQ3Q1W3Mn0lBYgOkvXlmoe 7qqw== X-Gm-Message-State: AOJu0YxDfKjtwms9fBB3/5O0zzUbc14pb9scjsFNoSGn1ECXzDLm+Q6u bIHup1QsnUS93D5iFu1R9C6zFKdgDKIkNmhabLkv6UDEHunsnUubJKPhYhcEnWyYm6LbX8WzI+H Y X-Received: by 2002:a17:903:110c:b0:20c:5698:75cd with SMTP id d9443c01a7336-20c636eb2a7mr13032315ad.2.1728432306088; Tue, 08 Oct 2024 17:05:06 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v3 11/20] target/hppa: Implement TCGCPUOps.tlb_fill_align Date: Tue, 8 Oct 2024 17:04:44 -0700 Message-ID: <20241009000453.315652-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Convert hppa_cpu_tlb_fill to hppa_cpu_tlb_fill_align so that we can recognize alignment exceptions in the correct priority order. Resolves: https://bugzilla.kernel.org/show_bug.cgi?id=219339 Signed-off-by: Richard Henderson Reviewed-by: Helge Deller Tested-by: Helge Deller --- target/hppa/cpu.h | 6 +++--- target/hppa/cpu.c | 2 +- target/hppa/mem_helper.c | 21 ++++++++++++--------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 526855f982..e45ba50a59 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -363,9 +363,9 @@ void hppa_cpu_dump_state(CPUState *cs, FILE *f, int); void hppa_ptlbe(CPUHPPAState *env); hwaddr hppa_cpu_get_phys_page_debug(CPUState *cs, vaddr addr); void hppa_set_ior_and_isr(CPUHPPAState *env, vaddr addr, bool mmu_disabled); -bool hppa_cpu_tlb_fill(CPUState *cs, vaddr address, int size, - MMUAccessType access_type, int mmu_idx, - bool probe, uintptr_t retaddr); +bool hppa_cpu_tlb_fill_align(CPUState *cs, CPUTLBEntryFull *out, vaddr addr, + MMUAccessType access_type, int mmu_idx, + MemOp memop, int size, bool probe, uintptr_t ra); void hppa_cpu_do_interrupt(CPUState *cpu); bool hppa_cpu_exec_interrupt(CPUState *cpu, int int_req); int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 7cf2e2f266..c38439c180 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -226,7 +226,7 @@ static const TCGCPUOps hppa_tcg_ops = { .restore_state_to_opc = hppa_restore_state_to_opc, #ifndef CONFIG_USER_ONLY - .tlb_fill = hppa_cpu_tlb_fill, + .tlb_fill_align = hppa_cpu_tlb_fill_align, .cpu_exec_interrupt = hppa_cpu_exec_interrupt, .cpu_exec_halt = hppa_cpu_has_work, .do_interrupt = hppa_cpu_do_interrupt, diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index d38054da8a..b8c3e55170 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -424,12 +424,11 @@ void hppa_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, } } -bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, - MMUAccessType type, int mmu_idx, - bool probe, uintptr_t retaddr) +bool hppa_cpu_tlb_fill_align(CPUState *cs, CPUTLBEntryFull *out, vaddr addr, + MMUAccessType type, int mmu_idx, + MemOp memop, int size, bool probe, uintptr_t ra) { - HPPACPU *cpu = HPPA_CPU(cs); - CPUHPPAState *env = &cpu->env; + CPUHPPAState *env = cpu_env(cs); int prot, excp, a_prot; hwaddr phys; @@ -445,7 +444,7 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, break; } - excp = hppa_get_physical_address(env, addr, mmu_idx, a_prot, 0, + excp = hppa_get_physical_address(env, addr, mmu_idx, a_prot, memop, &phys, &prot); if (unlikely(excp >= 0)) { if (probe) { @@ -454,7 +453,7 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, trace_hppa_tlb_fill_excp(env, addr, size, type, mmu_idx); /* Failure. Raise the indicated exception. */ - raise_exception_with_ior(env, excp, retaddr, addr, + raise_exception_with_ior(env, excp, ra, addr, MMU_IDX_MMU_DISABLED(mmu_idx)); } @@ -468,8 +467,12 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, * the large page protection mask. We do not require this, * because we record the large page here in the hppa tlb. */ - tlb_set_page(cs, addr & TARGET_PAGE_MASK, phys & TARGET_PAGE_MASK, - prot, mmu_idx, TARGET_PAGE_SIZE); + memset(out, 0, sizeof(*out)); + out->phys_addr = phys; + out->prot = prot; + out->attrs = MEMTXATTRS_UNSPECIFIED; + out->lg_page_size = TARGET_PAGE_BITS; + return true; }