From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx154.postini.com [74.125.245.154]) by kanga.kvack.org (Postfix) with SMTP id DF4986B0032 for ; Wed, 10 Jul 2013 09:00:06 -0400 (EDT) Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 10 Jul 2013 13:54:49 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 752D617D8063 for ; Wed, 10 Jul 2013 14:01:37 +0100 (BST) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r6ACxp8S45875358 for ; Wed, 10 Jul 2013 12:59:51 GMT Received: from d06av11.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r6AD01om012271 for ; Wed, 10 Jul 2013 07:00:02 -0600 From: Dominik Dingel Subject: [PATCH 2/4] PF: Make KVM_HVA_ERR_BAD usable on s390 Date: Wed, 10 Jul 2013 14:59:53 +0200 Message-Id: <1373461195-27628-3-git-send-email-dingel@linux.vnet.ibm.com> In-Reply-To: <1373461195-27628-1-git-send-email-dingel@linux.vnet.ibm.com> References: <1373461195-27628-1-git-send-email-dingel@linux.vnet.ibm.com> Sender: owner-linux-mm@kvack.org List-ID: To: Gleb Natapov , Paolo Bonzini Cc: Christian Borntraeger , Heiko Carstens , Martin Schwidefsky , Cornelia Huck , Xiantao Zhang , Alexander Graf , Christoffer Dall , Marc Zyngier , Ralf Baechle , kvm@vger.kernel.org, linux-s390@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Dominik Dingel Current common code uses PAGE_OFFSET to indicate a bad host virtual address. As this check won't work on architectures that don't map kernel and user memory into the same address space (e.g. s390), such architectures can now provide there own KVM_HVA_ERR_BAD defines. Signed-off-by: Dominik Dingel --- arch/s390/include/asm/kvm_host.h | 8 ++++++++ include/linux/kvm_host.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h index 3238d40..cd30c3d 100644 --- a/arch/s390/include/asm/kvm_host.h +++ b/arch/s390/include/asm/kvm_host.h @@ -274,6 +274,14 @@ struct kvm_arch{ int css_support; }; +#define KVM_HVA_ERR_BAD (-1UL) +#define KVM_HVA_ERR_RO_BAD (-1UL) + +static inline bool kvm_is_error_hva(unsigned long addr) +{ + return addr == KVM_HVA_ERR_BAD; +} + extern int sie64a(struct kvm_s390_sie_block *, u64 *); extern char sie_exit; #endif diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index a63d83e..92e8f64 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -85,6 +85,12 @@ static inline bool is_noslot_pfn(pfn_t pfn) return pfn == KVM_PFN_NOSLOT; } +/* + * architectures with KVM_HVA_ERR_BAD other than PAGE_OFFSET (e.g. s390) + * provide own defines and kvm_is_error_hva + */ +#ifndef KVM_HVA_ERR_BAD + #define KVM_HVA_ERR_BAD (PAGE_OFFSET) #define KVM_HVA_ERR_RO_BAD (PAGE_OFFSET + PAGE_SIZE) @@ -93,6 +99,8 @@ static inline bool kvm_is_error_hva(unsigned long addr) return addr >= PAGE_OFFSET; } +#endif + #define KVM_ERR_PTR_BAD_PAGE (ERR_PTR(-ENOENT)) static inline bool is_error_page(struct page *page) -- 1.8.2.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org