From: Ralf Baechle Subject: Re: [PATCH 20/30] KVM: MIPS/MMU: Invalidate GVA PTs on ASID changes Date: Wed, 11 Jan 2017 09:34:58 +0100 Message-ID: <20170111083458.GF31072@linux-mips.org> References: <201701111154365057441@zte.com.cn> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: james.hogan@imgtec.com, linux-mips@linux-mips.org, pbonzini@redhat.com, rkrcmar@redhat.com, kvm@vger.kernel.org To: jiang.biao2@zte.com.cn Return-path: Received: from eddie.linux-mips.org ([148.251.95.138]:48828 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753007AbdAKIfG (ORCPT ); Wed, 11 Jan 2017 03:35:06 -0500 Received: from localhost.localdomain ([127.0.0.1]:33398 "EHLO linux-mips.org" rhost-flags-OK-OK-OK-FAIL) by eddie.linux-mips.org with ESMTP id S23993885AbdAKIfEBd7LG (ORCPT ); Wed, 11 Jan 2017 09:35:04 +0100 Content-Disposition: inline In-Reply-To: <201701111154365057441@zte.com.cn> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jan 11, 2017 at 11:54:36AM +0800, jiang.biao2@zte.com.cn wrote: > Date: Wed, 11 Jan 2017 11:54:36 +0800 (CST) > From: jiang.biao2@zte.com.cn > To: james.hogan@imgtec.com > Cc: linux-mips@linux-mips.org, james.hogan@imgtec.com, pbonzini@redhat.com, > rkrcmar@redhat.com, ralf@linux-mips.org, kvm@vger.kernel.org > Subject: Re: [PATCH 20/30] KVM: MIPS/MMU: Invalidate GVA PTs on ASID changes > Content-Type: multipart/mixed; boundary="=====_001_next=====" > > Hi, > > > > +void kvm_mips_flush_gva_pt(pgd_t *pgd, enum kvm_mips_flush flags) > > > +{ > > > + if (flags & KMF_GPA) { > > > + /* all of guest virtual address space could be affected */ > > + if (flags & KMF_KERN) > > + /* useg, kseg0, seg2/3 */ > > + kvm_mips_flush_gva_pgd(pgd, 0, 0x7fffffff); > > + else > > + /* useg */ > > + kvm_mips_flush_gva_pgd(pgd, 0, 0x3fffffff); > > + } else { > > + /* useg */ > > + kvm_mips_flush_gva_pgd(pgd, 0, 0x3fffffff); > > + > > + /* kseg2/3 */ > > + if (flags & KMF_KERN) > > + kvm_mips_flush_gva_pgd(pgd, 0x60000000, 0x7fffffff); > > + } > > > +} > > > Is it maybe better to replace the hard code *0x7fffffff*, *0x60000000*, > *0x3fffffff* with marco? I think to anybody familiar with the architecture the raw numbers are easier to understand than weird defines. Ralf