Date/Time 4 hours ahead - Ubuntu 20 host/ Windows 10 guest

2021-06-07 Thread Weiss, Howard
Whenever I start my guest OS, the date/time is 4 hours ahead.  I disable 
synchronization with Internet Time and correct the date/time, then restarted 
the guest.  The time reverted to being 4 hours ahead.


RE: Usinger high resolution timers in simulated device

2021-02-12 Thread Weiss, Howard
Peter 

Please point me to an example of a qemu  simulated device which uses timer.h.  
Thanks

Howard

-Original Message-
From: Peter Maydell  
Sent: Wednesday, February 10, 2021 5:31 AM
To: Weiss, Howard 
Cc: qemu-discuss@nongnu.org
Subject: Re: Usinger high resolution timers in simulated device

External Mail


On Tue, 9 Feb 2021 at 22:12, Weiss, Howard  wrote:
>
> PMM
>
> Thanks.  Yes I am trying to implement  a timer within a QEMU device (the 
> hardware I am simulating generates an interrupt each 1/120 of a second.  Any 
> suggestions are welcome and appreciated. Please point me to documentation for 
> the internal timer API

I just did:

> You probably want the QEMUTimer APIs from include/qemu/timer.h.

Generally QEMU APIs are documented in comments in the headers.

-- PMM


Implementing power states in QEMU devices

2021-02-10 Thread Weiss, Howard
I am writing a QEMU simulated device to debug a windows device driver which I 
am running in a Windows 10 target VM

A device power state describes the power state of a device in a computer, 
independently of the other devices in the computer. Device power states are 
named D0, D1, D2, and D3. D0 is the fully on state, and D1, D2, and D3 are 
low-power states..  Please see 
https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/device-power-states

The   
WDF_INTERRUPT_CONFIG
 structure passed to 

  
WdfInterruptCreate
 method when creating a device in a windows device driver allows the user to 
specify an EvtInterruptEnable callback function which is invoked each time the 
device enters its working (D0) state. The driver I am testing uses this method 
to initialize shared memory

How do I set the power state of my simulated device in QEMU?

Howard Weiss


RE: Usinger high resolution timers in simulated device

2021-02-09 Thread Weiss, Howard
PMM

Thanks.  Yes I am trying to implement  a timer within a QEMU device (the 
hardware I am simulating generates an interrupt each 1/120 of a second.  Any 
suggestions are welcome and appreciated. Please point me to documentation for 
the internal timer API

Howard

-Original Message-
From: Peter Maydell  
Sent: Tuesday, February 9, 2021 4:30 PM
To: Weiss, Howard 
Cc: qemu-discuss@nongnu.org
Subject: Re: Usinger high resolution timers in simulated device

External Mail


On Tue, 9 Feb 2021 at 21:23, Weiss, Howard  wrote:
>
> I am created a simulated device to test a Windows device driver.  The 
> simulated device runs under Linux. I use QEMU to create a Windows 10 
> virtual machine in which I run the device driver
>
>
>
> In the simulated device, I need a timer which interrupts my device 
> driver every 8.3 ms.  I have patterned my timer on the high resolution 
> timer
>
> to be found at 
> https://www.softprayog.in/tutorials/alarm-sleep-and-high-resolution-timers.

Are you trying to implement a timer inside a QEMU device model?
You need to use QEMU's internal timer APIs for this kind of thing:
trying to create new threads and use signals within QEMU itself is not going to 
work well with QEMU's existing use of those facilities.

You probably want the QEMUTimer APIs from include/qemu/timer.h.

PS: don't expect that you'll necessarily get accurate every-8.3-ms timings. 
QEMU's emulation is best-effort, not real-time.

thanks
-- PMM


Usinger high resolution timers in simulated device

2021-02-09 Thread Weiss, Howard
I am created a simulated device to test a Windows device driver.  The simulated 
device runs under Linux. I use QEMU to create a Windows 10 virtual machine in 
which I run the device driver

In the simulated device, I need a timer which interrupts my device driver every 
8.3 ms.  I have patterned my timer on the high resolution timer
to be found at 
https://www.softprayog.in/tutorials/alarm-sleep-and-high-resolution-timers.  
This example sets up two timers - one timer which runs at a specific interval 
and a second timer which expires some number of seconds after it starts.  The 
program starts both timers and then performs a sigwait on the second timer.  
The example ends after the second timer is signaled.

In my case, I created another task and which I started on a separate thread.  I 
removed the exit at the end of the thread.  I observed that my application 
terminated at the point where the second thread was signaled.   I observe that 
if I add a printf after the signal, it never happens.  I tried substituting 
SIGRTMAX for SIGRTMIN.  My application terminates regardless.

Why would this be. I theorize that QEMU is using the signalling mechanism and I 
am unknowningly setting a signal which causes QEMU to terminate.

Is there a correct way to do this?

Howard Weiss


IRQ question

2021-02-07 Thread Weiss, Howard
I am running QEMU on Ubuntu. My target system runs Windows 10. I am writing a 
simulated device to test the a Windows device driver

If my Windows device driver is at interrupt level when it invokes my simulated 
device (eg reads/writes a port) does the code in my simulated device also run 
ar interrupt level?

Thank you

Get Outlook for iOS


How to determine IRQ level of target Windows 10 system

2021-02-06 Thread Weiss, Howard
I am running on a Ubuntu laptop.  I use QEMU to run a virtual windows 10 system.

How can I determine the IRQ level of the code running on the windows 10 system?




How to simulate a device which generates an interrupt every 8.3 ms

2020-12-09 Thread Weiss, Howard
Hi -

I am writing a Windows 10 device driver which receives an interrupt from 
hardware every 8.3 ms.  I am simulating the hardware device in a linux QEMU/KVM 
VM with Windows 10 installed.  How do I program my simulated device to generate 
an interrupt every 8.3 ms? Under windows, I would generate a high resolution 
timer interrupt using the windows multi-media API.  What is the QEMU/KVM 
equivalent?

Thanks

Howard Weiss


RE: Qemu-discuss Digest, Vol 110, Issue 22

2020-11-22 Thread Weiss, Howard
The driver I am working with is patterned on a driver described in " 
How-to-develop-embedded-software-using-the-QEMU-machine-emulator-by-Apriorit".  
It uses SHA256 routines so I need to be able to build my driver with openssl. 

My problem is that the final link of qemu-system-x86_64 fails per below

LINKx86_64-softmmu/qemu-system-x86_64
/usr/bin/ld: ../hw/misc/hello_world_device.o: in function 
`crypto_set_aes_cbc_key_256':
/home/howard/qemu-5.1.0/hw/misc/hello_world_device.c:446: undefined reference 
to `SHA256'
/usr/bin/ld: ../hw/misc/hello_world_device.o: in function `DoSha256':
/home/howard/qemu-5.1.0/hw/misc/hello_world_device.c:2300: undefined reference 
to `SHA256_Init'
/usr/bin/ld: /home/howard/qemu-5.1.0/hw/misc/hello_world_device.c:2328: 
undefined reference to `SHA256_Update'
/usr/bin/ld: /home/howard/qemu-5.1.0/hw/misc/hello_world_device.c:2346: 
undefined reference to `SHA256_Final'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:219: qemu-system-x86_64] Error 1
make: *** [Makefile:527: x86_64-softmmu/all] Error 2

The final link command is very long and is not work repeating in the email.  
Via make-n, I have determined that the statement starts and ends as follows

printf "  %-7s %s\n" "LINK" "x86_64-softmmu/qemu-system-x86_64" &&  c++ -g  
-Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64  -fstack-protector-strong  
-o qemu-system-x86_64 exec.o exec-vary.o  
-L/home/howard/qemu-5.1.0/capstone -lcapstone  -lm -lz -lgthread-2.0 -pthread 
-lglib-2.0  -lrt

If I manually append "-L/usr/local/src/openssl-1.1.1c -lcrypto" to the end of 
the command, then the link of qemu-system-x86_64 succeeds

I am unable to determine how to coerce the make system to add the library 
reference to the link statment.  If tried 
--extra-ldflags="-L/usr/local/src/openssl-1.1.1c -lcrypto", the text was added 
at the beginning of the link statement (after -Wl statements and had no 
effect).  What config or make option must I use add the needed text at the end 
of the link statement

Howard Weiss


-Original Message-
From: Qemu-discuss  
On Behalf Of qemu-discuss-requ...@nongnu.org
Sent: Saturday, November 21, 2020 12:00 PM
To: qemu-discuss@nongnu.org
Subject: Qemu-discuss Digest, Vol 110, Issue 22

External Mail


Send Qemu-discuss mailing list submissions to
qemu-discuss@nongnu.orgMy 

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.nongnu.org/mailman/listinfo/qemu-discuss
or, via email, send a message with subject or body 'help' to
qemu-discuss-requ...@nongnu.org

You can reach the person managing the list at
qemu-discuss-ow...@nongnu.org

When replying, please edit your Subject line so it is more specific than "Re: 
Contents of Qemu-discuss digest..."


Today's Topics:

   1. How to use SHA256 in a QEMU device (Weiss, Howard)
   2. Re: How to use SHA256 in a QEMU device (Alberto Garcia)


----------

Message: 1
Date: Fri, 20 Nov 2020 21:33:18 +
From: "Weiss, Howard" 
To: "qemu-discuss@nongnu.org" 
Subject: How to use SHA256 in a QEMU device
Message-ID:



Content-Type: text/plain; charset="utf-8"

I am writing a device which uses SHA256

I use the following to configure the build

   ./configure -target-list=x86_64-softmmu -enable-sdl -enable-debug 
-extra-ldflags="'pkg-config -libs openssl'"

With PKG_CONFIG_PATH is defined via

  export PKG_CONFIG_PATH=/usr/local/openssl-1.1.1c


How do I correctly incorporate the SHA256 h files in the C source for driver

I have tried

  #include 

but this results in a build failure

  fatal error: openssl.sha.h: No such file or directory

I even went so far as to copy the include folder for opensl-1.1.1c to 
qemu/include/opensll and convert all the #include <...> to #include "...".  I 
can then change my c source to #include "openssl/sha.h" and the device builds 
but it then fails to link with undefined reference to the various SHA... modules

I read an earlier post with suggest including -lssl and -lcrypto in the 
-extra-cflags and -extra-ldflags options in ./configure but this did not work 
because -lcrypto is not defined

Please advise;

PS: Is there a description of the configure process and its options?

-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.nongnu.org/archive/html/qemu-discuss/attachments/20201120/504da9ae/attachment.html>

--

Message: 2
Date: Sat, 21 Nov 2020 01:42:59 +0100
From: Alberto Garcia 
To: qemu-discuss@nongnu.org
Subject: Re: How to use SHA256 in a QEMU device
Message-ID: <20201121004259.ga16...@igalia.com>
Content-Type: text/plain; charset=us-ascii

On Fri, Nov 20, 2020 at 09:33:18PM +, Weiss, Howard wrote:
> I am writing a device whi

How to use SHA256 in a QEMU device

2020-11-20 Thread Weiss, Howard
I am writing a device which uses SHA256

I use the following to configure the build

   ./configure -target-list=x86_64-softmmu -enable-sdl -enable-debug 
-extra-ldflags="'pkg-config -libs openssl'"

With PKG_CONFIG_PATH is defined via

  export PKG_CONFIG_PATH=/usr/local/openssl-1.1.1c


How do I correctly incorporate the SHA256 h files in the C source for driver

I have tried

  #include 

but this results in a build failure

  fatal error: openssl.sha.h: No such file or directory

I even went so far as to copy the include folder for opensl-1.1.1c to 
qemu/include/opensll and convert all the #include <...> to #include "...".  I 
can then change my c source to #include "openssl/sha.h" and the device builds 
but it then fails to link with undefined reference to the various SHA... modules

I read an earlier post with suggest including -lssl and -lcrypto in the 
-extra-cflags and -extra-ldflags options in ./configure but this did not work 
because -lcrypto is not defined

Please advise;

PS: Is there a description of the configure process and its options?



Device Driver Install Timeout running Windows 10 in QEMU virtual machine

2020-11-19 Thread Weiss, Howard
I am exploring writing a simulated device to debug a windows 10 device driver.  
I have added my device to QEMU and it appears as a PCI device in the Device 
Manager in Windows.  I have also written a Windows 10 device driver.  I attempt 
to install the device driver.  The Plug and Play Service starts to install the 
driver but eventually times out and exits with the code cff - Device 
install failed for device.  Please advise


security certificate is not trusted by your computers operating system

2020-10-24 Thread Weiss, Howard
Hi -

I am running qemu 5.1.0 which installed via qemu-w64-setup-20200814.exe which I 
download from https://qemu.weilnetz.de/w64/

I then started windows 10 in qemu as follows

qemu-system-x86_64 -accel whpx -m 4G  -cdrom Windows.iso -hda 
./windows_10_image.qcow2 -net nic -net user  -object 
cryptodev-backend-builtin,id=cryptodev0 -device 
virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0  -vga std -boot strict=on

I want to test out the crypto device driver from Apiorit preparatory to 
creating a virtual device to test out user driver

I used qemu-img to create windows_10_image.qcow2 and windows.iso is downloaded 
from Microsoft

Windows 10 comes up fine. However, whenever I run any browser I see the 
following message

"security certificate is not trusted by your computer's operating system"

It appears that access via https is being denied

I assume I need a different driver.  I initially tried to install Windows 10 
with "-net nic,model=virtio -net user" but windows would not install because 
there was no internet access

There are a number of devices listed when  execute -devices help
Network devices:
name "e1000", bus PCI, alias "e1000-82540em", desc "Intel Gigabit Ethernet"
name "e1000-82544gc", bus PCI, desc "Intel Gigabit Ethernet"
name "e1000-82545em", bus PCI, desc "Intel Gigabit Ethernet"
name "e1000e", bus PCI, desc "Intel 82574L GbE Controller"
name "i82550", bus PCI, desc "Intel i82550 Ethernet"
name "i82551", bus PCI, desc "Intel i82551 Ethernet"
name "i82557a", bus PCI, desc "Intel i82557A Ethernet"
name "i82557b", bus PCI, desc "Intel i82557B Ethernet"
name "i82557c", bus PCI, desc "Intel i82557C Ethernet"
name "i82558a", bus PCI, desc "Intel i82558A Ethernet"
name "i82558b", bus PCI, desc "Intel i82558B Ethernet"
name "i82559a", bus PCI, desc "Intel i82559A Ethernet"
name "i82559b", bus PCI, desc "Intel i82559B Ethernet"
name "i82559c", bus PCI, desc "Intel i82559C Ethernet"
name "i82559er", bus PCI, desc "Intel i82559ER Ethernet"
name "i82562", bus PCI, desc "Intel i82562 Ethernet"
name "i82801", bus PCI, desc "Intel i82801 Ethernet"
name "ne2k_isa", bus ISA
name "ne2k_pci", bus PCI
name "pcnet", bus PCI
name "rocker", bus PCI, desc "Rocker Switch"
name "rtl8139", bus PCI
name "tulip", bus PCI
name "usb-net", bus usb-bus
name "virtio-net-device", bus virtio-bus
name "virtio-net-pci", bus PCI, alias "virtio-net"
name "virtio-net-pci-non-transitional", bus PCI
name "virtio-net-pci-transitional", bus PCI
name "vmxnet3", bus PCI, desc "VMWare Paravirtualized Ethernet v3"

Should I be using one of these?

Howard Weus






New to QEMU

2020-07-26 Thread Weiss, Howard
I would like to run Windows 10 in a QEMU virtual machine on a Windows 10 
computer

I can successful start QEMU on Windows 10 and start the Windows 10 installation 
in the virtual machine.  Thank you Jay Jay.

The installation stops because it want to know where to install Windows 10

Can I use Qimg to create a virtual Machine and point qemu-system-x86-64.exe to 
install Windows 10 into that virtual machine?  Which command option do I use to 
qemu-system-x86_64?

Is this correct?

Do I need to install Linux in the QEMU virtual machine before I can install 
Windows 10

What is recommended procedure

Thanks

Howard Weiss