From patchwork Thu Jan 20 13:58:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasad Joshi X-Patchwork-Id: 491961 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0KEUWGn011715 for ; Thu, 20 Jan 2011 14:30:32 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755715Ab1ATN6H (ORCPT ); Thu, 20 Jan 2011 08:58:07 -0500 Received: from mail-qy0-f174.google.com ([209.85.216.174]:49361 "EHLO mail-qy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755711Ab1ATN6G (ORCPT ); Thu, 20 Jan 2011 08:58:06 -0500 Received: by qyj19 with SMTP id 19so1949689qyj.19 for ; Thu, 20 Jan 2011 05:58:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=imiOdnMRXC3cYeyT0SZU3GhEVaKsL9F5PRxgqUDUzRg=; b=ILW139zDaZaQA1FKDdckWMCJENj2JTcJKntUc6BJbmG2N+sCeA3z6YVzmb31gE7+KK N+0TSqPWbsjBUbSSlpifERqyKyi7RQ+B1WWZDUIJZuSFbpd1i+ikUx/+LiL6a6mRDLMY XByRo68ynWkPFxw3QVeh+HZpO1mxf2HETrahQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=pirRaKUqJ2gnPX4FCQGejGFh6dCcZDU19rxf9BLk3fF0M7Qx9D4ZRwm/42/aqtsK3I mxlJnjNIbOcYu38ePw3Cjug8++IHFVoVOcMi7KWAlE5YuG0AlHn+tQ1I6FtFsI6hlCPP 4/HUlz8YWav1vDHEPLfae+GpmasvCwAlRpnkI= MIME-Version: 1.0 Received: by 10.229.242.83 with SMTP id lh19mr1774540qcb.226.1295531885682; Thu, 20 Jan 2011 05:58:05 -0800 (PST) Received: by 10.229.250.80 with HTTP; Thu, 20 Jan 2011 05:58:05 -0800 (PST) Date: Thu, 20 Jan 2011 13:58:05 +0000 Message-ID: Subject: [PATCH 1/1]: Log more information on IO_PAGE_FAULT event. From: Prasad Joshi To: kvm@vger.kernel.org Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 20 Jan 2011 14:30:33 +0000 (UTC) diff --git a/arch/x86/include/asm/amd_iommu_types.h b/arch/x86/include/asm/amd_iommu_types.h index e3509fc..add56b3 100644 --- a/arch/x86/include/asm/amd_iommu_types.h +++ b/arch/x86/include/asm/amd_iommu_types.h @@ -96,6 +96,16 @@ #define EVENT_FLAGS_MASK 0xfff #define EVENT_FLAGS_SHIFT 0x10 +#define EVENT_FLAGS_RESERVED1 0x0 +#define EVENT_FLAGS_RESERVED_SIZE 0x3 +#define EVENT_FLAGS_INT (EVENT_FLAGS_RESERVED1 + EVENT_FLAGS_RESERVED_SIZE) +#define EVENT_FLAGS_PR (EVENT_FLAGS_INT + 0x1) +#define EVENT_FLAGS_RW (EVENT_FLAGS_PR + 0x1) +#define EVENT_FLAGS_PE (EVENT_FLAGS_RW + 0x1) +#define EVENT_FLAGS_RZ (EVENT_FLAGS_PE + 0x1) +#define EVENT_FLAGS_TR (EVENT_FLAGS_RZ + 0x1) +#define EVENT_FLAGS_RESERVED2 (EVENT_FLAGS_TR + 0x1) + /* feature control bits */ #define CONTROL_IOMMU_EN 0x00ULL #define CONTROL_HT_TUN_EN 0x01ULL diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index 57ca777..a158852 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c @@ -283,6 +283,44 @@ static void dump_command(unsigned long phys_addr) pr_err("AMD-Vi: CMD[%d]: %08x\n", i, cmd->data[i]); } +static void inline dump_page_fault(int flags) +{ + int i = (flags >> EVENT_FLAGS_INT) & 0x1; + int pr = (flags >> EVENT_FLAGS_PR) & 0x1; + int rw = (flags >> EVENT_FLAGS_RW) & 0x1; + int pe = (flags >> EVENT_FLAGS_PE) & 0x1; + int rz = (flags >> EVENT_FLAGS_RZ) & 0x1; + int tr = (flags >> EVENT_FLAGS_TR) & 0x1; + + const char *i_pr[] = { + "to page marked not present", + "to page marked present", + "to interrupt marked blocked", + "to interrupt marked remapped" + }; + + const char *tr_s[2] = { + "transaction", + "translation" + }; + + const char *type[2] = { + "read", + "write" + }; + + const char *permission[2] = { + "peripheral had permission", + "peripheral had no permission", + }; + + pr_err("AMD-Vi: \t%s %s", tr_s[tr], i_pr[(i<<1)|pr]); + pr_err("AMD-Vi: \t%s type: %s", tr_s[tr], type[rw]); + if (pr) { + pr_err("AMD-Vi: \t%s", permission[pe]); + } +} + static void iommu_print_event(struct amd_iommu *iommu, void *__evt) { u32 *event = __evt; @@ -307,6 +345,7 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt) "domain=0x%04x address=0x%016llx flags=0x%04x]\n", PCI_BUS(devid), PCI_SLOT(devid), PCI_FUNC(devid), domid, address, flags); + dump_page_fault(flags); break; case EVENT_TYPE_DEV_TAB_ERR: