From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH v7] kvm: notify host when the guest is panicked Date: Sun, 22 Jul 2012 14:22:42 -0500 Message-ID: <87txwzwqgt.fsf@codemonkey.ws> References: <500A565A.8080403@cn.fujitsu.com> <500A8969.1040300@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Gleb Natapov , kvm list , Jan Kiszka , qemu-devel , "linux-kernel@vger.kernel.org" , Avi Kivity , KAMEZAWA Hiroyuki To: Sasha Levin , Wen Congyang Return-path: In-Reply-To: <500A8969.1040300@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org List-Id: kvm.vger.kernel.org Sasha Levin writes: > On 07/21/2012 09:12 AM, Wen Congyang wrote: >> +#define KVM_PV_PORT (0x505UL) >> + >> #ifdef __KERNEL__ >> #include >> >> @@ -221,6 +223,11 @@ static inline void kvm_disable_steal_time(void) >> } >> #endif >> >> +static inline unsigned int kvm_arch_pv_features(void) >> +{ >> + return inl(KVM_PV_PORT); >> +} >> + > > Why is this safe? > > I'm not sure you can just pick any ioport you'd like and use it. There are three ways I/O ports get used on a PC: 1) Platform devices - This is well defined since the vast majority of platform devices are implemented within a single chip. If you're emulating an i440fx chipset, the PIIX4 spec has an exhaustive list. 2) PCI devices - Typically, PCI only allocates ports starting at 0x0d00 to avoid conflicts with ISA devices. 3) ISA devices - ISA uses subtractive decoding so any ISA device can access. In theory, an ISA device could attempt to use port 0x0505 but it's unlikely. In a modern guest, there aren't really any ISA devices being added either. So yes, picking port 0x0505 is safe for something like this (as long as you check to make sure that you really are under KVM). Regards, Anthony Liguori > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752499Ab2GVTWt (ORCPT ); Sun, 22 Jul 2012 15:22:49 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:50987 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752444Ab2GVTWr (ORCPT ); Sun, 22 Jul 2012 15:22:47 -0400 From: Anthony Liguori To: Sasha Levin , Wen Congyang Cc: kvm list , qemu-devel , "linux-kernel\@vger.kernel.org" , Avi Kivity , "Daniel P. Berrange" , KAMEZAWA Hiroyuki , Jan Kiszka , Gleb Natapov Subject: Re: [Qemu-devel] [PATCH v7] kvm: notify host when the guest is panicked In-Reply-To: <500A8969.1040300@gmail.com> References: <500A565A.8080403@cn.fujitsu.com> <500A8969.1040300@gmail.com> User-Agent: Notmuch/0.13.2+60~g7ecf77d (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Sun, 22 Jul 2012 14:22:42 -0500 Message-ID: <87txwzwqgt.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sasha Levin writes: > On 07/21/2012 09:12 AM, Wen Congyang wrote: >> +#define KVM_PV_PORT (0x505UL) >> + >> #ifdef __KERNEL__ >> #include >> >> @@ -221,6 +223,11 @@ static inline void kvm_disable_steal_time(void) >> } >> #endif >> >> +static inline unsigned int kvm_arch_pv_features(void) >> +{ >> + return inl(KVM_PV_PORT); >> +} >> + > > Why is this safe? > > I'm not sure you can just pick any ioport you'd like and use it. There are three ways I/O ports get used on a PC: 1) Platform devices - This is well defined since the vast majority of platform devices are implemented within a single chip. If you're emulating an i440fx chipset, the PIIX4 spec has an exhaustive list. 2) PCI devices - Typically, PCI only allocates ports starting at 0x0d00 to avoid conflicts with ISA devices. 3) ISA devices - ISA uses subtractive decoding so any ISA device can access. In theory, an ISA device could attempt to use port 0x0505 but it's unlikely. In a modern guest, there aren't really any ISA devices being added either. So yes, picking port 0x0505 is safe for something like this (as long as you check to make sure that you really are under KVM). Regards, Anthony Liguori > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1St1jt-0006mX-3D for qemu-devel@nongnu.org; Sun, 22 Jul 2012 15:22:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1St1jr-0002Br-UA for qemu-devel@nongnu.org; Sun, 22 Jul 2012 15:22:49 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:62174) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1St1jr-0002Bl-Np for qemu-devel@nongnu.org; Sun, 22 Jul 2012 15:22:47 -0400 Received: by pbbro12 with SMTP id ro12so9511489pbb.4 for ; Sun, 22 Jul 2012 12:22:47 -0700 (PDT) From: Anthony Liguori In-Reply-To: <500A8969.1040300@gmail.com> References: <500A565A.8080403@cn.fujitsu.com> <500A8969.1040300@gmail.com> Date: Sun, 22 Jul 2012 14:22:42 -0500 Message-ID: <87txwzwqgt.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH v7] kvm: notify host when the guest is panicked List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sasha Levin , Wen Congyang Cc: Gleb Natapov , kvm list , Jan Kiszka , qemu-devel , "linux-kernel@vger.kernel.org" , Avi Kivity , KAMEZAWA Hiroyuki Sasha Levin writes: > On 07/21/2012 09:12 AM, Wen Congyang wrote: >> +#define KVM_PV_PORT (0x505UL) >> + >> #ifdef __KERNEL__ >> #include >> >> @@ -221,6 +223,11 @@ static inline void kvm_disable_steal_time(void) >> } >> #endif >> >> +static inline unsigned int kvm_arch_pv_features(void) >> +{ >> + return inl(KVM_PV_PORT); >> +} >> + > > Why is this safe? > > I'm not sure you can just pick any ioport you'd like and use it. There are three ways I/O ports get used on a PC: 1) Platform devices - This is well defined since the vast majority of platform devices are implemented within a single chip. If you're emulating an i440fx chipset, the PIIX4 spec has an exhaustive list. 2) PCI devices - Typically, PCI only allocates ports starting at 0x0d00 to avoid conflicts with ISA devices. 3) ISA devices - ISA uses subtractive decoding so any ISA device can access. In theory, an ISA device could attempt to use port 0x0505 but it's unlikely. In a modern guest, there aren't really any ISA devices being added either. So yes, picking port 0x0505 is safe for something like this (as long as you check to make sure that you really are under KVM). Regards, Anthony Liguori > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html