From patchwork Thu May 21 16:39:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 187054 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp1728642ilb; Thu, 21 May 2020 10:05:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVP/VW+mDu9NJw9JeOCXbucrwOj+L2hEAUm+lXp7wP7R6mDGdxhlpyydOaxuiPITX9jh4H X-Received: by 2002:a05:620a:809:: with SMTP id s9mr10487786qks.91.1590080748941; Thu, 21 May 2020 10:05:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590080748; cv=none; d=google.com; s=arc-20160816; b=iogGNFA/HGCcbdLq23q/d+OQYkkE2vSJmhhQgQhFWUIgUftLvWhCohacHTJO90Xvmk 9VF+92KMJ25qxLTG4OLdkCGW2Z8/OEmu2d75IyUWPdohMARqyZ2oqIgivn/QrOyDWH0O TbLQRbYRpSbOsD6zJGlAQYoPnN5qxh2uYsf2yskU2Z0vjzVZiCCUG98wj51n68GQHxCN XXJy4XD2JAJjQ+eG687W7XcX+6f3K5403sZa6lGVDL1beW3sXdTO9c5CYtvH6i6tHAhF reDkXe9SpOEdkGsJ9lspFBasqYnkvatn1dmNlNpmhaA6+yEahzWZk3rWDcfFBYOkBdvH CS+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=s4hrOWLlZCdJWXysypnArxYHpdNRngJdlfVjmEHFHi0=; b=XyPTGVfgW9hGHwG9LN0FIB7cKE7nkUIpcIpVFNNPrvgv5l3zcH1nbCeEqFtlEDRgaf nzUBjI8JuhrI6/uIUiv7m7teDNkq0Yu38ZOoMgUbrHlApeDrBTZwngV9HdBu/ZJ3KySU oMdNATj0d91kXJjphBgGKKH8fFoCvRcFisWGwZ1R+kHDPCHzSv2yKScOAGfPJRvljYp+ dYvBuiwMV7XuwZjzUDKoEgucwpcN8oNPY5mKNrsCkgCFbusaGlxp6tHYwQZHdSf3hPHT F/hUGnDMCClEL7maG6MD76KVRbL1J/bPDMuWyqLOJ5UFHw7JK8mYMrMtGBSsvZa0eGIJ 4sFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=u4Arfkbx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w143si695759qkb.198.2020.05.21.10.05.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 May 2020 10:05:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=u4Arfkbx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbodg-0005LD-CF for patch@linaro.org; Thu, 21 May 2020 13:05:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50002) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIn-0003jq-Ml for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:13 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:45002) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIm-0006c6-Mq for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:13 -0400 Received: by mail-qk1-x743.google.com with SMTP id b6so7813608qkh.11 for ; Thu, 21 May 2020 09:44:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s4hrOWLlZCdJWXysypnArxYHpdNRngJdlfVjmEHFHi0=; b=u4ArfkbxegKy6OUgbVv2mkmVN0sz0duoLipCvIIiUEPoNRNVN634iz7hLO1AcVv4fE 73Ev/Xkn8zoRWuZlF3FcA384xrqqDbBHYLTposjM2f+njbGox0FUfydWkt+5lEo0lUAV farZEEcSZ3yCpGgpDH5DDGgx1qf6pkJGY7aphwd82lPPcUtHYWD+uJvsZ9DxjGJaEIFU b1Pq/JUZtIQVm/NpUN9tbTCh1PMDQGuOVDp8RZLSrf+OH1HVqWKNYllgCgQhaC08ACk2 H3feNnkzuN4+zlSiZu/Ptm2tSJNZV7uuw47hOsIFwrpNLTXVVMjHxLG6pjlLq/PQuR+d 3lHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s4hrOWLlZCdJWXysypnArxYHpdNRngJdlfVjmEHFHi0=; b=Cw/3VHZF0dMa8iIoPj3SP+8q38hK4ezQCBx8l5KWrOUYTmEnpz3vgVB1mln0NeOqBj 80yMbI59tJMQaqjqGJrkhv5HvVFEf9aQRpOtn2EB+gGyThtYeDaL/7mh0brcT1VDeTFb bZh7LaOWYP6m7lf9KRVyJm4+udfmChLZp0L5Q7asaFaVlyob5QJ72+0Zh04dtoSrY/+U G0Zp46At6w9ks7U7lFuPTe4aJN3KtXgTP+VF6d8Ctqr33mLjyC+eQhODAFLT/IqiihY+ ETOdYEAgtPcJ3RoFK/j4LwFdS7xq4vOUiGKLPYz6xZ+oygI4E45EboWgUzStFbP4Rw+r +nMw== X-Gm-Message-State: AOAM531BxS1lUtYKW89zBs9kZ+fesnsdBhQT+hNZnzbJK1YVWKWpa+na k+hGNbpw8aTEP8UDYroi9Vz0a1oe8qP+nQ== X-Received: by 2002:a05:620a:204e:: with SMTP id d14mr9449775qka.13.1590079451503; Thu, 21 May 2020 09:44:11 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:10 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 42/74] i386/hax-all: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:39 -0400 Message-Id: <20200521164011.638-43-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x743.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota [RF: Converted new code to cpu_interrupt_request] Signed-off-by: Robert Foley --- target/i386/hax-all.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) -- 2.17.1 diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c index 1edd6c77df..66de14b27b 100644 --- a/target/i386/hax-all.c +++ b/target/i386/hax-all.c @@ -285,7 +285,7 @@ int hax_vm_destroy(struct hax_vm *vm) static void hax_handle_interrupt(CPUState *cpu, int mask) { - cpu->interrupt_request |= mask; + cpu_interrupt_request_or(cpu, mask); if (!qemu_cpu_is_self(cpu)) { qemu_cpu_kick(cpu); @@ -419,7 +419,7 @@ static int hax_vcpu_interrupt(CPUArchState *env) * Unlike KVM, HAX kernel check for the eflags, instead of qemu */ if (ht->ready_for_interrupt_injection && - (cpu->interrupt_request & CPU_INTERRUPT_HARD)) { + (cpu_interrupt_request(cpu) & CPU_INTERRUPT_HARD)) { int irq; irq = cpu_get_pic_interrupt(env); @@ -433,7 +433,7 @@ static int hax_vcpu_interrupt(CPUArchState *env) * interrupt, request an interrupt window exit. This will * cause a return to userspace as soon as the guest is ready to * receive interrupts. */ - if ((cpu->interrupt_request & CPU_INTERRUPT_HARD)) { + if ((cpu_interrupt_request(cpu) & CPU_INTERRUPT_HARD)) { ht->request_interrupt_window = 1; } else { ht->request_interrupt_window = 0; @@ -472,7 +472,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) return 0; } - if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { + if (cpu_interrupt_request(cpu) & CPU_INTERRUPT_POLL) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); apic_poll_irq(x86_cpu->apic_state); } @@ -495,20 +495,20 @@ static int hax_vcpu_hax_exec(CPUArchState *env) * c) INIT signal; * d) SIPI signal. */ - if (((cpu->interrupt_request & CPU_INTERRUPT_HARD) && + if (((cpu_interrupt_request(cpu) & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || - (cpu->interrupt_request & CPU_INTERRUPT_NMI)) { + (cpu_interrupt_request(cpu) & CPU_INTERRUPT_NMI)) { cpu_halted_set(cpu, 0); } - if (cpu->interrupt_request & CPU_INTERRUPT_INIT) { + if (cpu_interrupt_request(cpu) & CPU_INTERRUPT_INIT) { DPRINTF("\nhax_vcpu_hax_exec: handling INIT for %d\n", cpu->cpu_index); do_cpu_init(x86_cpu); hax_vcpu_sync_state(env, 1); } - if (cpu->interrupt_request & CPU_INTERRUPT_SIPI) { + if (cpu_interrupt_request(cpu) & CPU_INTERRUPT_SIPI) { DPRINTF("hax_vcpu_hax_exec: handling SIPI for %d\n", cpu->cpu_index); hax_vcpu_sync_state(env, 0); @@ -577,13 +577,17 @@ static int hax_vcpu_hax_exec(CPUArchState *env) ret = -1; break; case HAX_EXIT_HLT: - if (!(cpu->interrupt_request & CPU_INTERRUPT_HARD) && - !(cpu->interrupt_request & CPU_INTERRUPT_NMI)) { - /* hlt instruction with interrupt disabled is shutdown */ - env->eflags |= IF_MASK; - cpu_halted_set(cpu, 1); - cpu->exception_index = EXCP_HLT; - ret = 1; + { + uint32_t interrupt_request = cpu_interrupt_request(cpu); + + if (!(interrupt_request & CPU_INTERRUPT_HARD) && + !(interrupt_request & CPU_INTERRUPT_NMI)) { + /* hlt instruction with interrupt disabled is shutdown */ + env->eflags |= IF_MASK; + cpu_halted_set(cpu, 1); + cpu->exception_index = EXCP_HLT; + ret = 1; + } } break; /* these situations will continue to hax module */