Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933610AbcLNRYC (ORCPT ); Wed, 14 Dec 2016 12:24:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51250 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932673AbcLNRYA (ORCPT ); Wed, 14 Dec 2016 12:24:00 -0500 Subject: Re: [PATCH v2 3/3] kvm: svm: Use the hardware provided GPA instead of page walk To: Brijesh Singh References: <147992048887.27638.17559991037474542240.stgit@brijesh-build-machine> <147992052008.27638.18095073174935903705.stgit@brijesh-build-machine> <65a10dd8-5fae-350f-b597-f8f0261da766@redhat.com> <9820037d-e3ca-0131-3b04-2e51f2abc883@amd.com> <657442146.2535029.1481298111651.JavaMail.zimbra@redhat.com> <6e1fd4ba-016c-99ea-5b98-24f89479da4b@amd.com> <057d8a2e-0a3a-38d3-d9bf-9301e3eb8238@redhat.com> <43e626f1-e9a6-cf5d-4771-c6f7ca07ec8e@amd.com> Cc: kvm@vger.kernel.org, thomas lendacky , rkrcmar@redhat.com, joro@8bytes.org, x86@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, hpa@zytor.com, tglx@linutronix.de, bp@suse.de From: Paolo Bonzini Message-ID: Date: Wed, 14 Dec 2016 18:23:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <43e626f1-e9a6-cf5d-4771-c6f7ca07ec8e@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 14 Dec 2016 17:24:00 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 899 Lines: 24 On 14/12/2016 18:07, Brijesh Singh wrote: >> > > Since now we are going to perform multiple conditional checks before > concluding that its safe to use HW provided GPA. How about if we add two > functions "emulator_is_rep_string_op" and "emulator_is_two_mem_op" into > emulator.c and use these functions inside the x86.c to determine if its > safe to use HW provided gpa? Why not export only emulator_can_use_gpa from emulate.c? (So in the end leaving emulator_is_string_op in emulate.c was the right thing to do, it was just the test that was wrong :)). The patch below is still missing the check for cross-page MMIO. Your reference to the BKDG only covers MMCONFIG (sometimes referred to as ECAM), not MMIO in general. Doing AND or OR into video memory for example is perfectly legal, and I'm fairly sure that some obscure legacy software does PUSH/POP into vram as well! Thanks, Paolo