From patchwork Mon May 14 19:03:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 8626 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 51CE523EAB for ; Mon, 14 May 2012 19:27:03 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 223E9A1880F for ; Mon, 14 May 2012 19:27:03 +0000 (UTC) Received: by mail-yx0-f180.google.com with SMTP id q6so5822442yen.11 for ; Mon, 14 May 2012 12:27:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=zIoJMVI21OQhdTHxiljJkOW+nyvKZrdSkgvz0xn62uw=; b=N/sWVExvGjHkvX6Z+hQKRLeN8VYkRqSEN5tnmL1YLAQiAkOUY9Yw+oVMk+WcMpm118 0krFor5GvU78gMYsiAKnCTTbtrsESjxDZi2cKJ2FUsaxLF464yoohqPdt4LmRpnPQuiQ 4WdhJGWr4NXmuGTlmXYFZ1PsWhCrYr0NmnYHVOjM68Piudj4a6K/HPIDueN85wDYJUlD UtmXq5otWcRtgnIPnrbe/yLKr48pRc+190THNnynS40H3/d9S+11wb84OOPvsEoiPNcn lt0KIp6bmSNrqMK9yaesdVhzeX90NsXTrhYpCRpzCv7toaplrYEImcZQ5NNSbfzJs45K hQYA== Received: by 10.50.40.193 with SMTP id z1mr5056572igk.0.1337023622729; Mon, 14 May 2012 12:27:02 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.35.72 with SMTP id o8csp367234ibd; Mon, 14 May 2012 12:27:01 -0700 (PDT) Received: by 10.180.81.166 with SMTP id b6mr22452273wiy.0.1337023620704; Mon, 14 May 2012 12:27:00 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id w35si916656wew.136.2012.05.14.12.26.59 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 14 May 2012 12:27:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1SU0YP-0005nS-Na; Mon, 14 May 2012 20:03:33 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Paul Brook , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Rusty Russell Subject: [PATCH qom-next v2 20/33] target-arm: Convert cp15 MMU TLB control Date: Mon, 14 May 2012 20:03:19 +0100 Message-Id: <1337022212-22219-21-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1337022212-22219-1-git-send-email-peter.maydell@linaro.org> References: <1337022212-22219-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQmjUKCeSYWbnDFzgtOKsgfd2RnTSoR6mqP2YFaG0cujXVfGCKt3YfIYa9uAv7iuPim4GTNq Convert cp15 MMU TLB control (crn=8) to new scheme. Signed-off-by: Peter Maydell --- target-arm/helper.c | 63 ++++++++++++++++++++++++++++++++++---------------- 1 files changed, 43 insertions(+), 20 deletions(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index c371224..d57f943 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -93,6 +93,38 @@ static int contextidr_write(CPUARMState *env, const ARMCPRegInfo *ri, return 0; } +static int tlbiall_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + /* Invalidate all (TLBIALL) */ + tlb_flush(env, 1); + return 0; +} + +static int tlbimva_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + /* Invalidate single TLB entry by MVA and ASID (TLBIMVA) */ + tlb_flush_page(env, value & TARGET_PAGE_MASK); + return 0; +} + +static int tlbiasid_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + /* Invalidate by ASID (TLBIASID) */ + tlb_flush(env, value == 0); + return 0; +} + +static int tlbimvaa_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + /* Invalidate single entry by MVA, all ASIDs (TLBIMVAA) */ + tlb_flush_page(env, value & TARGET_PAGE_MASK); + return 0; +} + static const ARMCPRegInfo cp_reginfo[] = { /* DBGDIDR: just RAZ. In particular this means the "debug architecture * version" bits will read as a reserved value, which should cause @@ -116,6 +148,17 @@ static const ARMCPRegInfo cp_reginfo[] = { */ { .name = "TLB_LOCKDOWN", .cp = 15, .crn = 10, .crm = CP_ANY, .opc1 = CP_ANY, .opc2 = CP_ANY, .access = PL1_RW, .type = ARM_CP_NOP }, + /* MMU TLB control. Note that the wildcarding means we cover not just + * the unified TLB ops but also the dside/iside/inner-shareable variants. + */ + { .name = "TLBIALL", .cp = 15, .crn = 8, .crm = CP_ANY, + .opc1 = CP_ANY, .opc2 = 0, .access = PL1_W, .writefn = tlbiall_write, }, + { .name = "TLBIMVA", .cp = 15, .crn = 8, .crm = CP_ANY, + .opc1 = CP_ANY, .opc2 = 1, .access = PL1_W, .writefn = tlbimva_write, }, + { .name = "TLBIASID", .cp = 15, .crn = 8, .crm = CP_ANY, + .opc1 = CP_ANY, .opc2 = 2, .access = PL1_W, .writefn = tlbiasid_write, }, + { .name = "TLBIMVAA", .cp = 15, .crn = 8, .crm = CP_ANY, + .opc1 = CP_ANY, .opc2 = 3, .access = PL1_W, .writefn = tlbimvaa_write, }, REGINFO_SENTINEL }; @@ -1840,24 +1883,6 @@ void HELPER(set_cp15)(CPUARMState *env, uint32_t insn, uint32_t val) } } break; - case 8: /* MMU TLB control. */ - switch (op2) { - case 0: /* Invalidate all (TLBIALL) */ - tlb_flush(env, 1); - break; - case 1: /* Invalidate single TLB entry by MVA and ASID (TLBIMVA) */ - tlb_flush_page(env, val & TARGET_PAGE_MASK); - break; - case 2: /* Invalidate by ASID (TLBIASID) */ - tlb_flush(env, val == 0); - break; - case 3: /* Invalidate single entry by MVA, all ASIDs (TLBIMVAA) */ - tlb_flush_page(env, val & TARGET_PAGE_MASK); - break; - default: - goto bad_reg; - } - break; case 9: if (arm_feature(env, ARM_FEATURE_OMAPCP)) break; @@ -2070,8 +2095,6 @@ uint32_t HELPER(get_cp15)(CPUARMState *env, uint32_t insn) /* FIXME: Should only clear Z flag if destination is r15. */ env->ZF = 0; return 0; - case 8: /* MMU TLB control. */ - goto bad_reg; case 9: switch (crm) { case 0: /* Cache lockdown */