From patchwork Wed Jun 17 21:01:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 190946 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp815109ilo; Wed, 17 Jun 2020 14:29:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNUEPiyx07KdYRPxfi9lLjJEhOYyIWuDLrsT37DDutepjfWdh4Jq43DT6dAV3fvxRRifrn X-Received: by 2002:a05:6902:4e9:: with SMTP id w9mr1436938ybs.311.1592429386217; Wed, 17 Jun 2020 14:29:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592429386; cv=none; d=google.com; s=arc-20160816; b=tehQ6b0M50y2vryFBoPWiWrWvJvpPUYQlxjrSN0JpHglZNqui5xB43c7EkP3ajlvTG PqScnWh+TIxFR6uf2gt20qK9tzW4eYf2Uh3u2FISdAu/la9+IhjnVwFl7MXMVS4O6rcy FgExszvns2a/9cg7vmWzINreDUBJzZCtxBJY0XcJwMK9Lu+bVR5ci0f9V9kc7t6FdIqG yQuliUuEbNybtlbqxfNi5v56WywEcgFxFo7gVVmGQinwbmklPPFaB76OkDSk5pj/h3m6 aHfitvjBOMZowPM1ltXEs0Lu2ZeKuEBsFmI231YsNB0Mcp9sCCAt1BKaGueVQgUGgjgf l1qA== 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=VHZjlUaQqM5GtwqE4D5+D6h1EspkQ+6Rl4guLSEBSAc=; b=Qzpiv34BAssStKQM8llbQnq7Xs/lg3VEzHeIx8gItJ4dPng3l7lF/P3nfcRGi35i01 c/ZHVCIoeuALpVpYJ4lX0Rp0j4MW5zwQ2dDmO4/hieVNj9Tliy5rovSexS9P2jN2lGz7 8tiumg1S71sxfKBjlLzQJiagkLIBB1eG8TbnAjuilsoKobop4/9nSSyn8CD17kv0Ycal U5Mm9pNF3T0IdA+XknIwgFICw3p/5cNokfFR1D0VOLlJ3e1qbeFVSEkvdwc0yLnZsVWW UxOyQkXdmUE4JZpP06BsAg4yJU82t9AdXrgcjEwhdn/wjwqdYU7wG1VJ/x2kG3AKR9q9 9Dqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rW65jctj; 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 m8si675880ybo.29.2020.06.17.14.29.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Jun 2020 14:29:46 -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=rW65jctj; 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]:45292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfcv-0003ul-J9 for patch@linaro.org; Wed, 17 Jun 2020 17:29:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEJ-0003fb-3G for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:19 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:40509) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEH-0000As-8o for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:18 -0400 Received: by mail-qk1-x742.google.com with SMTP id c185so3482973qke.7 for ; Wed, 17 Jun 2020 14:04:16 -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=VHZjlUaQqM5GtwqE4D5+D6h1EspkQ+6Rl4guLSEBSAc=; b=rW65jctjvH3r1V0QQCpLFxV92Q8HELkZYRBzjiw48re9Oq4ktX+sKEWxBDM3ToS+ER wGl/jf00OTfgHLkjaKMUpx/AoKKU56sPW8nVgfFS8xc0NHsBx5Z0SqUxpYJkHEqVT6PW wbVuh145a6dEWUWL2+NNgeydVGpTxRn1qBE03mNHOW6y+Jk3IcIWww6e+gJjG3X6WCQz uv7hoPuReXuxzaPsL4epXTzDdHp96L2z9q939unvGXhrUdAebUwJAsXMvaJGS/1D21Yk Cw0FKFVyrCJCa1VXdjTtSb/985jjNnylrH9eCKny0oMnxqVqYFs6AP37CcZNZV4uNSQW kulw== 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=VHZjlUaQqM5GtwqE4D5+D6h1EspkQ+6Rl4guLSEBSAc=; b=ooYWCfz2JyLcsMcxQqQjjVjhkxcUo9j5NadwiHv6lrqB597gDenFaIefD9pHKuN4mT Y/Ka5DrkWtInAusXne8sci/f4fgqr5zlYH60hA9vsbu8nxKmcNcGMDqOQ87dGZe7eVwQ IrIpTHnF+J15dCXuPVMJyOfJ8gqqeRy3iAPXxL79FBLZKTFeMWpO5XzeDSWoWoFdFv3x z0KQSk8OsNO5ojuOS8FhJzP57OECDEfiWcw+H7F4TTcf3YCUnld9J6iNT2wWuQNSqdD3 OAf+V6wUFfAC2I79gx9Yr4/GS7PX440Em4s6ktybuFqERaYjTkkUa6Py8J1mbn4IWBau XN4A== X-Gm-Message-State: AOAM530ofFmWDcdX/ZRPMNIP5zx3eiT/Wzmg+DfVhsNtm+0gFIXFB7fH knm7a3lUBMrZFggfaDf/FV0tIA0w3YPRlg== X-Received: by 2002:a37:9ad5:: with SMTP id c204mr548600qke.413.1592427855921; Wed, 17 Jun 2020 14:04:15 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:15 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 41/73] i386/hax-all: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:01:59 -0400 Message-Id: <20200617210231.4393-42-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.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_HELO_NONE=0.001, SPF_PASS=-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: robert.foley@linaro.org, Eduardo Habkost , cota@braap.org, "open list:X86 HAXM CPUs" , Colin Xu , Paolo Bonzini , peter.puhov@linaro.org, Richard Henderson , alex.bennee@linaro.org, Wenchao Wang 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 6a4152730f..20a75a891f 100644 --- a/target/i386/hax-all.c +++ b/target/i386/hax-all.c @@ -298,7 +298,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); @@ -432,7 +432,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); @@ -446,7 +446,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; @@ -485,7 +485,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); } @@ -508,20 +508,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); @@ -590,13 +590,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 */