Add missing attributions to hvf:
cover Add missing attributions to hvf:
The following 2 patch's add a missing attributions to the hvf code
PATCH 1/2 Add missing hvdos public domain attribution:
hvf.c and vmx.h contain code from hvdos.c that is released as public domain:
from hvdos github: https://github.com/mist64/hvdos
"License
See LICENSE.txt (2-clause-BSD).
In order to simplify use of this code as a template, you can consider any parts from "hvdos.c" and "interface.h" as being in the public domain."
--- target/i386/hvf/hvf.c | 3 +++ target/i386/hvf/vmx.h | 3 +++ 2 files changed, 6 insertions(+)
target/i386/hvf/hvf.c +3 -0
@@ -17,6 +17,9 @@* * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, see <http://www.gnu.org/licenses/>. +* +* This file contain code under public domain from the hvdos project: +* https://github.com/mist64/hvdos */ #include "qemu/osdep.h" #include "qemu-common.h"
target/i386/hvf/vmx.h +3 -0
@@ -17,6 +17,9 @@* * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, see <http://www.gnu.org/licenses/>. +* +* This file contain code under public domain from the hvdos project: +* https://github.com/mist64/hvdos */ #ifndef VMX_H
Signature · 1 line
2.13.6 (Apple Git-96)
PATCH 2/2 ept_emulation_fault() need NetApp BSD attribution:
In reply to Izik EidusMoving it to a new file and add the BSD license there.
--- target/i386/hvf/ept_fault.h | 70 +++++++++++++++++++++++++++++++++++++++++++++ target/i386/hvf/hvf.c | 38 +----------------------- 2 files changed, 71 insertions(+), 37 deletions(-) create mode 100644 target/i386/hvf/ept_fault.h
target/i386/hvf/ept_fault.h new file +70 -0
@@ -0,0 +1,70 @@ +/*- +* Copyright (c) 2011 NetApp, Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +*/ + +#ifndef EPT_FAULT_H +#define EPT_FAULT_H + +#include "hvf-i386.h" + +static inline bool ept_emulation_fault (hvf_slot *slot,uint64_t gpa,uint64_t ept_qual) +{ +int read, write; + +/* EPT fault on an instruction fetch doesn't make sense here */ +if (ept_qual &EPT_VIOLATION_INST_FETCH ) { +return false; + } + +/* EPT fault must be a read fault or a write fault */ + read = ept_qual &EPT_VIOLATION_DATA_READ ?1 :0 ; + write = ept_qual &EPT_VIOLATION_DATA_WRITE ?1 :0 ; +if ((read | write) ==0 ) { +return false; + } + +if (write && slot) { +if (slot->flags &HVF_SLOT_LOG ) { +memory_region_set_dirty (slot->region, gpa - slot->start,1 ); +hv_vm_protect ((hv_gpaddr_t )slot->start, (size_t )slot->size, +HV_MEMORY_READ |HV_MEMORY_WRITE ); + } + } + +/* +* The EPT violation must have been caused by accessing a +* guest-physical address that is a translation of a guest-linear +* address. +*/ +if ((ept_qual &EPT_VIOLATION_GLA_VALID ) ==0 || + (ept_qual &EPT_VIOLATION_XLAT_VALID ) ==0 ) { +return false; + } + +return !slot; +} + + +#endif
target/i386/hvf/hvf.c +1 -37
@@ -36,6 +36,7 @@#include "x86_emu.h" #include "x86_task.h" #include "x86hvf.h" +#include "ept_fault.h" #include <Hypervisor/hv.h> #include <Hypervisor/hv_vmx.h>
@@ -292,43 +293,6 @@ void hvf_cpu_synchronize_post_init(CPUState *cpu_state)run_on_cpu (cpu_state, _hvf_cpu_synchronize_post_init,RUN_ON_CPU_NULL ); } -static bool ept_emulation_fault (hvf_slot *slot,uint64_t gpa,uint64_t ept_qual) -{ -int read, write; - -/* EPT fault on an instruction fetch doesn't make sense here */ -if (ept_qual &EPT_VIOLATION_INST_FETCH ) { -return false; - } - -/* EPT fault must be a read fault or a write fault */ - read = ept_qual &EPT_VIOLATION_DATA_READ ?1 :0 ; - write = ept_qual &EPT_VIOLATION_DATA_WRITE ?1 :0 ; -if ((read | write) ==0 ) { -return false; - } - -if (write && slot) { -if (slot->flags &HVF_SLOT_LOG ) { -memory_region_set_dirty (slot->region, gpa - slot->start,1 ); -hv_vm_protect ((hv_gpaddr_t )slot->start, (size_t )slot->size, -HV_MEMORY_READ |HV_MEMORY_WRITE ); - } - } - -/* -* The EPT violation must have been caused by accessing a -* guest-physical address that is a translation of a guest-linear -* address. -*/ -if ((ept_qual &EPT_VIOLATION_GLA_VALID ) ==0 || - (ept_qual &EPT_VIOLATION_XLAT_VALID ) ==0 ) { -return false; - } - -return !slot; -} -static void hvf_set_dirty_tracking (MemoryRegionSection *section,bool on) {hvf_slot *slot;
Signature · 1 line
2.13.6 (Apple Git-96)
Re: [Qemu-devel] [PATCH 2/2] ept_emulation_fault() need NetApp BSD attribution:
Quoted 3 lines · Izik Eidus
Moving it to a new file and add the BSD license there.
Signed-off-by Izik Eidus <[email protected]>
Since it's compatible, I'm just adding the NetApp BSD license to the file.
What is the original source? xhyve or something like that?
Paolo
Quoted 139 lines
--- target/i386/hvf/ept_fault.h | 70 +++++++++++++++++++++++++++++++++++++++++++++ target/i386/hvf/hvf.c | 38 +----------------------- 2 files changed, 71 insertions(+), 37 deletions(-) create mode 100644 target/i386/hvf/ept_fault.htarget/i386/hvf/ept_fault.h new file +70
-0@@ -0,0 +1,70 @@ +/*- +* Copyright (c) 2011 NetApp, Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +*/ + +#ifndef EPT_FAULT_H +#define EPT_FAULT_H + +#include "hvf-i386.h" + +static inline bool ept_emulation_fault (hvf_slot *slot,uint64_t gpa,uint64_t ept_qual) +{ +int read, write; + +/* EPT fault on an instruction fetch doesn't make sense here */ +if (ept_qual &EPT_VIOLATION_INST_FETCH ) { +return false; + } + +/* EPT fault must be a read fault or a write fault */ + read = ept_qual &EPT_VIOLATION_DATA_READ ?1 :0 ; + write = ept_qual &EPT_VIOLATION_DATA_WRITE ?1 :0 ; +if ((read | write) ==0 ) { +return false; + } + +if (write && slot) { +if (slot->flags &HVF_SLOT_LOG ) { +memory_region_set_dirty (slot->region, gpa - slot->start,1 ); +hv_vm_protect ((hv_gpaddr_t )slot->start, (size_t )slot->size, +HV_MEMORY_READ |HV_MEMORY_WRITE ); + } + } + +/* +* The EPT violation must have been caused by accessing a +* guest-physical address that is a translation of a guest-linear +* address. +*/ +if ((ept_qual &EPT_VIOLATION_GLA_VALID ) ==0 || + (ept_qual &EPT_VIOLATION_XLAT_VALID ) ==0 ) { +return false; + } + +return !slot; +} + + +#endif target/i386/hvf/hvf.c +1
-37@@ -36,6 +36,7 @@#include "x86_emu.h" #include "x86_task.h" #include "x86hvf.h" +#include "ept_fault.h" #include <Hypervisor/hv.h> #include <Hypervisor/hv_vmx.h> @@ -292,43 +293,6 @@ void hvf_cpu_synchronize_post_init(CPUState *cpu_state)run_on_cpu (cpu_state, _hvf_cpu_synchronize_post_init,RUN_ON_CPU_NULL ); } -static bool ept_emulation_fault (hvf_slot *slot,uint64_t gpa,uint64_t ept_qual) -{ -int read, write; - -/* EPT fault on an instruction fetch doesn't make sense here */ -if (ept_qual &EPT_VIOLATION_INST_FETCH ) { -return false; - } - -/* EPT fault must be a read fault or a write fault */ - read = ept_qual &EPT_VIOLATION_DATA_READ ?1 :0 ; - write = ept_qual &EPT_VIOLATION_DATA_WRITE ?1 :0 ; -if ((read | write) ==0 ) { -return false; - } - -if (write && slot) { -if (slot->flags &HVF_SLOT_LOG ) { -memory_region_set_dirty (slot->region, gpa - slot->start,1 ); -hv_vm_protect ((hv_gpaddr_t )slot->start, (size_t )slot->size, -HV_MEMORY_READ |HV_MEMORY_WRITE ); - } - } - -/* -* The EPT violation must have been caused by accessing a -* guest-physical address that is a translation of a guest-linear -* address. -*/ -if ((ept_qual &EPT_VIOLATION_GLA_VALID ) ==0 || - (ept_qual &EPT_VIOLATION_XLAT_VALID ) ==0 ) { -return false; - } - -return !slot; -} -static void hvf_set_dirty_tracking (MemoryRegionSection *section,bool on) {hvf_slot *slot;
Re: [Qemu-devel] [PATCH 2/2] ept_emulation_fault() need NetApp BSD attribution:
Quoted 6 lines · Paolo Bonzini
Quoted 3 lines · Izik Eidus
Moving it to a new file and add the BSD license there.
Signed-off-by Izik Eidus <[email protected]>Since it's compatible, I'm just adding the NetApp BSD license to the file.
Sure.
Quoted 2 lines
What is the original source? xhyve or something like that?
This function is from freebsd:sys/amd64/vmm/intel/vmx.c
http://web.mit.edu/freebsd/head/sys/amd64/vmm/intel/vmx.c
Thanks.
Quoted 143 lines
Paolo
Quoted 139 lines
--- target/i386/hvf/ept_fault.h | 70 +++++++++++++++++++++++++++++++++++++++++++++ target/i386/hvf/hvf.c | 38 +----------------------- 2 files changed, 71 insertions(+), 37 deletions(-) create mode 100644 target/i386/hvf/ept_fault.htarget/i386/hvf/ept_fault.h new file +70
-0@@ -0,0 +1,70 @@ +/*- +* Copyright (c) 2011 NetApp, Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +*/ + +#ifndef EPT_FAULT_H +#define EPT_FAULT_H + +#include "hvf-i386.h" + +static inline bool ept_emulation_fault (hvf_slot *slot,uint64_t gpa,uint64_t ept_qual) +{ +int read, write; + +/* EPT fault on an instruction fetch doesn't make sense here */ +if (ept_qual &EPT_VIOLATION_INST_FETCH ) { +return false; + } + +/* EPT fault must be a read fault or a write fault */ + read = ept_qual &EPT_VIOLATION_DATA_READ ?1 :0 ; + write = ept_qual &EPT_VIOLATION_DATA_WRITE ?1 :0 ; +if ((read | write) ==0 ) { +return false; + } + +if (write && slot) { +if (slot->flags &HVF_SLOT_LOG ) { +memory_region_set_dirty (slot->region, gpa - slot->start,1 ); +hv_vm_protect ((hv_gpaddr_t )slot->start, (size_t )slot->size, +HV_MEMORY_READ |HV_MEMORY_WRITE ); + } + } + +/* +* The EPT violation must have been caused by accessing a +* guest-physical address that is a translation of a guest-linear +* address. +*/ +if ((ept_qual &EPT_VIOLATION_GLA_VALID ) ==0 || + (ept_qual &EPT_VIOLATION_XLAT_VALID ) ==0 ) { +return false; + } + +return !slot; +} + + +#endif target/i386/hvf/hvf.c +1
-37@@ -36,6 +36,7 @@#include "x86_emu.h" #include "x86_task.h" #include "x86hvf.h" +#include "ept_fault.h" #include <Hypervisor/hv.h> #include <Hypervisor/hv_vmx.h> @@ -292,43 +293,6 @@ void hvf_cpu_synchronize_post_init(CPUState *cpu_state)run_on_cpu (cpu_state, _hvf_cpu_synchronize_post_init,RUN_ON_CPU_NULL ); } -static bool ept_emulation_fault (hvf_slot *slot,uint64_t gpa,uint64_t ept_qual) -{ -int read, write; - -/* EPT fault on an instruction fetch doesn't make sense here */ -if (ept_qual &EPT_VIOLATION_INST_FETCH ) { -return false; - } - -/* EPT fault must be a read fault or a write fault */ - read = ept_qual &EPT_VIOLATION_DATA_READ ?1 :0 ; - write = ept_qual &EPT_VIOLATION_DATA_WRITE ?1 :0 ; -if ((read | write) ==0 ) { -return false; - } - -if (write && slot) { -if (slot->flags &HVF_SLOT_LOG ) { -memory_region_set_dirty (slot->region, gpa - slot->start,1 ); -hv_vm_protect ((hv_gpaddr_t )slot->start, (size_t )slot->size, -HV_MEMORY_READ |HV_MEMORY_WRITE ); - } - } - -/* -* The EPT violation must have been caused by accessing a -* guest-physical address that is a translation of a guest-linear -* address. -*/ -if ((ept_qual &EPT_VIOLATION_GLA_VALID ) ==0 || - (ept_qual &EPT_VIOLATION_XLAT_VALID ) ==0 ) { -return false; - } - -return !slot; -} -static void hvf_set_dirty_tracking (MemoryRegionSection *section,bool on) {hvf_slot *slot;