From patchwork Mon Feb 29 15:04:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 8455011 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 03A62C0553 for ; Mon, 29 Feb 2016 15:06:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8F79F2014A for ; Mon, 29 Feb 2016 15:06:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8D324202C8 for ; Mon, 29 Feb 2016 15:06:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754674AbcB2PE5 (ORCPT ); Mon, 29 Feb 2016 10:04:57 -0500 Received: from 8bytes.org ([81.169.241.247]:56356 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752001AbcB2PE4 (ORCPT ); Mon, 29 Feb 2016 10:04:56 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id 97B4B394; Mon, 29 Feb 2016 16:04:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1456758294; bh=pFK7TWAR7vfcp7juvxXsu79NUzw/HCjUoYSDu/cqnGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cz5QBzAKh7s6TACV9z2Lw5rUY5oYBl9H9BSbt7NIanaJDQ2uldhts13wMfTwvoUKB 9XU7u3JsznGHO0TSqy03L5FgfFVyR7UAQIE7sGIOYLHT2xRdXFdITiCzY200Tj39U5 sOLWJGrTmreSqjjjOZe4Jcjc2uRDHqdryjXzEbfOjbhwKSbIWVpbA3lgTzm5GHjxkn U7z8Kw2CzqCC3rhMwznKgJdQoFPqVEO0YyvFZHir4GIjlZ2tSHMU/ph+KNdlnI9PNB Kl874itB3OfI+Ld50M3lqxvWs5ovCTl5pIsNTzjvDqBil0E42gOqlzdVeP+Fl5pjTY ci3KOFRQ09fMA== From: Joerg Roedel To: Paolo Bonzini , Gleb Natapov Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Joerg Roedel Subject: [PATCH 2/3] kvm: x86: Track irq vectors in ioapic->rtc_status.dest_map Date: Mon, 29 Feb 2016 16:04:44 +0100 Message-Id: <1456758285-25060-3-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456758285-25060-1-git-send-email-joro@8bytes.org> References: <1456758285-25060-1-git-send-email-joro@8bytes.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Joerg Roedel This allows backtracking later in case the rtc irq has been moved to another vcpu/vector. Signed-off-by: Joerg Roedel --- arch/x86/kvm/ioapic.h | 7 +++++++ arch/x86/kvm/lapic.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/ioapic.h b/arch/x86/kvm/ioapic.h index af72989..7d2692a 100644 --- a/arch/x86/kvm/ioapic.h +++ b/arch/x86/kvm/ioapic.h @@ -41,7 +41,14 @@ struct kvm_vcpu; #endif struct dest_map { + /* vcpu bitmap where IRQ has been sent */ DECLARE_BITMAP(map, KVM_MAX_VCPUS); + + /* + * Vector sent to a given vcpu, only valid when + * the vcpu's bit in map is set + */ + u8 vectors[KVM_MAX_VCPUS]; }; diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 5b78c97..5ea7ef0 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -839,8 +839,10 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, result = 1; - if (dest_map) + if (dest_map) { __set_bit(vcpu->vcpu_id, dest_map->map); + dest_map->vectors[vcpu->vcpu_id] = vector; + } if (apic_test_vector(vector, apic->regs + APIC_TMR) != !!trig_mode) { if (trig_mode)