From patchwork Thu Aug 20 15:34:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 11726711 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 40746618 for ; Thu, 20 Aug 2020 15:36:28 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1D2092075E for ; Thu, 20 Aug 2020 15:36:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="THk88iUN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D2092075E Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k8mam-00074E-6H; Thu, 20 Aug 2020 15:35:04 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k8mal-00073R-OE for xen-devel@lists.xenproject.org; Thu, 20 Aug 2020 15:35:03 +0000 X-Inumbo-ID: 9b8898ea-4825-4517-87bf-4b598b951f64 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 9b8898ea-4825-4517-87bf-4b598b951f64; Thu, 20 Aug 2020 15:35:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1597937701; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=U6WGOnqz3Y31PJ1a+CdQ2M/flpyDjWIVzqWxfWUCibg=; b=THk88iUNW9kSns3UdYpM6Iz1NlLvSBA7PSjC1UGR5ADFWKtrsFMB7GIN Qp2hpsTEO+oZNAYZ1fP7HkYP/A625vpZC+7R4TP7gs61IeqEHt9reUo1d xepZbxzYcv/2FLEyPOMmWnvL01z0ak4w8btlDwvct2NuCkeQJ1f+KGU2r 8=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: xsKwCJi0O0w1LKtGM6gY/azk4WpIgM5Q/e4prcz7IUT7v46inmjKq/CSHYnO5w64i4B/hyIQPZ G2P7mmK0XZ4q+ha/oxUmYylbQUQqVXJwQcwmhviLeU7/TOH19lvCXfxMKKKtkL8Fwqym6oyyvP 5lceyWawwnnoCTEpBFezApExCfFcpxa2aXEaMIkQdMB2M2PKk/J66TEBcZWziXd3sDeLJOP34W P9CbHG1A3zhVMocpztf8Ex6jCP79qzCF81FUrbF8fBv6aqrYZaq4ChHDgepAYdTGIOvk952mAf J+E= X-SBRS: 2.7 X-MesageID: 25294991 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.76,333,1592884800"; d="scan'208";a="25294991" From: Roger Pau Monne To: CC: Roger Pau Monne , Jan Beulich , Andrew Cooper , Wei Liu Subject: [PATCH 1/2] x86/vpic: rename irq to pin in vpic_ioport_write Date: Thu, 20 Aug 2020 17:34:41 +0200 Message-ID: <20200820153442.28305-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820153442.28305-1-roger.pau@citrix.com> References: <20200820153442.28305-1-roger.pau@citrix.com> MIME-Version: 1.0 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The irq variable is wrongly named, as it's used to store the pin on the 8259 chip, but not the global irq value. While renaming reduce it's scope and make it unsigned. No functional change intended. Signed-off-by: Roger Pau Monné Acked-by: Andrew Cooper --- xen/arch/x86/hvm/vpic.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c index 936c7b27c6..feb1db2ee3 100644 --- a/xen/arch/x86/hvm/vpic.c +++ b/xen/arch/x86/hvm/vpic.c @@ -184,7 +184,7 @@ static int vpic_intack(struct hvm_hw_vpic *vpic) static void vpic_ioport_write( struct hvm_hw_vpic *vpic, uint32_t addr, uint32_t val) { - int priority, cmd, irq; + int priority, cmd; uint8_t mask, unmasked = 0; vpic_lock(vpic); @@ -230,6 +230,8 @@ static void vpic_ioport_write( } else { + unsigned int pin; + /* OCW2 */ cmd = val >> 5; switch ( cmd ) @@ -246,22 +248,22 @@ static void vpic_ioport_write( priority = vpic_get_priority(vpic, mask); if ( priority == VPIC_PRIO_NONE ) break; - irq = (priority + vpic->priority_add) & 7; - vpic->isr &= ~(1 << irq); + pin = (priority + vpic->priority_add) & 7; + vpic->isr &= ~(1 << pin); if ( cmd == 5 ) - vpic->priority_add = (irq + 1) & 7; + vpic->priority_add = (pin + 1) & 7; break; case 3: /* Specific EOI */ case 7: /* Specific EOI & Rotate */ - irq = val & 7; - vpic->isr &= ~(1 << irq); + pin = val & 7; + vpic->isr &= ~(1 << pin); if ( cmd == 7 ) - vpic->priority_add = (irq + 1) & 7; + vpic->priority_add = (pin + 1) & 7; /* Release lock and EOI the physical interrupt (if any). */ vpic_update_int_output(vpic); vpic_unlock(vpic); hvm_dpci_eoi(current->domain, - hvm_isa_irq_to_gsi((addr >> 7) ? (irq|8) : irq), + hvm_isa_irq_to_gsi((addr >> 7) ? (pin | 8) : pin), NULL); return; /* bail immediately */ case 6: /* Set Priority */ From patchwork Thu Aug 20 15:34:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 11726715 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 89836175D for ; Thu, 20 Aug 2020 15:36:32 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 66BA42075E for ; Thu, 20 Aug 2020 15:36:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="JL7sYxyG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66BA42075E Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k8mar-00075x-FH; Thu, 20 Aug 2020 15:35:09 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k8maq-00073R-OH for xen-devel@lists.xenproject.org; Thu, 20 Aug 2020 15:35:08 +0000 X-Inumbo-ID: 9e87654b-1000-4c67-9331-29cfc67269a6 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 9e87654b-1000-4c67-9331-29cfc67269a6; Thu, 20 Aug 2020 15:35:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1597937703; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=m0MqL0vp9RCmkiBc8RYLrmpVSs++vFfi2eCAWgx23YQ=; b=JL7sYxyGcgxblWkceXRReRCZiPRJuHiMfHo4rs+7Mc2UQvHKjk/9qJdY OvwOHICUNkohhutEqLAdc538JIpzhtXTeOBSjQi6Bob1lDYHBZRsMIO3D TyPDL48L1ZLpt+ujC7YaOp9ZfSS0/mXDaO0sK8fLZtnmLqkiVU2p7bIcq E=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: 0+xNgEV4nGwQ05xP97QOGBt2VFhllkn9X7C2zTUfK4UUQmxgrO/m5QxBXhTq0NBov8XVEqkjSy gBTUJOjrAPqy8iMzf/OhZheMF+LVmf9thKRxggxAQiA73JDME56mjZirVcFFCYohie8ueM9KDw WIfFB0CtECe4JR6tIdCMHDI/7cQmihiCp9pXq/DzyLMsWsuPFTYjC0HJl1SjVz1w+LwXBUYxHh Ht7NPLDbsjqWJm/kEsYGnHoLZl+1Kzg+fKyBmWk3k0OmBvCv4ulNjiGj+v5D10Zher/MJSFTub KKk= X-SBRS: 2.7 X-MesageID: 25294997 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.76,333,1592884800"; d="scan'208";a="25294997" From: Roger Pau Monne To: CC: Roger Pau Monne , Jan Beulich , Andrew Cooper , Wei Liu Subject: [PATCH 2/2] x86/vpic: also execute dpci callback for non-specific EOI Date: Thu, 20 Aug 2020 17:34:42 +0200 Message-ID: <20200820153442.28305-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820153442.28305-1-roger.pau@citrix.com> References: <20200820153442.28305-1-roger.pau@citrix.com> MIME-Version: 1.0 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Currently the dpci EOI callback is only executed for specific EOIs. This is wrong as non-specific EOIs will also clear the ISR bit and thus end the interrupt. Re-arrange the code a bit so that the common EOI handling path can be shared between all EOI modes. Signed-off-by: Roger Pau Monné --- xen/arch/x86/hvm/vpic.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c index feb1db2ee3..3cf12581e9 100644 --- a/xen/arch/x86/hvm/vpic.c +++ b/xen/arch/x86/hvm/vpic.c @@ -249,15 +249,15 @@ static void vpic_ioport_write( if ( priority == VPIC_PRIO_NONE ) break; pin = (priority + vpic->priority_add) & 7; - vpic->isr &= ~(1 << pin); - if ( cmd == 5 ) - vpic->priority_add = (pin + 1) & 7; - break; + goto common_eoi; + case 3: /* Specific EOI */ case 7: /* Specific EOI & Rotate */ pin = val & 7; + + common_eoi: vpic->isr &= ~(1 << pin); - if ( cmd == 7 ) + if ( cmd == 7 || cmd == 5 ) vpic->priority_add = (pin + 1) & 7; /* Release lock and EOI the physical interrupt (if any). */ vpic_update_int_output(vpic);