All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Internship idea: I2C passthrough
@ 2019-01-09 17:09 Stefan Hajnoczi
  2019-01-09 18:23 ` BALATON Zoltan
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Hajnoczi @ 2019-01-09 17:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Jim Mussared, Joel Stanley, Jonathan Austin

Hi folks,
You may be interested in I2C passthrough support in QEMU.  Paolo and I
brainstormed the idea and I've written up a rough project summary
below.  It still needs some work to make this a solid internship
project idea.

Any thoughts?  Would you like to co-mentor this summer?

=== I2C Passthrough ===

'''Summary:''' Implement I2C bus passthrough on Linux hosts so that
emulated Raspberry Pi or micro:bit boards can talk to real I2C
devices.

QEMU emulates I2C devices in software but currently cannot pass
through real I2C devices from the host to the guest.  It would be
useful to access real I2C devices from inside the guest, for example
for developers writing and testing software under QEMU on their
computer.

The project consists of the following tasks:
* Implement -object i2c-bus-passthrough,adapter=N,id=my-i2c-bus
* Add i2c-bus-passthrough support to at least 1 existing emulated I2C controller
* Implement micro:bit TWI controller emulation on the nRF51 system-on-chip

This project will allow you to learn about the I2C bus and how to
write device emulation code in QEMU.  You will enjoy it if you like
working with physical hardware.

'''Links:'''
* [https://en.wikipedia.org/wiki/I%C2%B2C I2C wikipedia page]
* [https://elinux.org/Interfacing_with_I2C_Devices Overview of Linux
I2C programming interfaces]
* [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/Documentation/i2c/dev-interface
Linux I2C userspace interface documentation]

'''Details:'''
* Skill level: intermediate
* Language: C
* Mentor: Paolo Bonzini <pbonzini@redhat.com> ("bonzini" on IRC),
Stefan Hajnoczi <stefanha@redhat.com> ("stefanha" on IRC)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] Internship idea: I2C passthrough
  2019-01-09 17:09 [Qemu-devel] Internship idea: I2C passthrough Stefan Hajnoczi
@ 2019-01-09 18:23 ` BALATON Zoltan
  2019-01-09 21:16   ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: BALATON Zoltan @ 2019-01-09 18:23 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: qemu-devel, Paolo Bonzini, Jim Mussared, Joel Stanley, Jonathan Austin

On Wed, 9 Jan 2019, Stefan Hajnoczi wrote:
> Hi folks,
> You may be interested in I2C passthrough support in QEMU.  Paolo and I
> brainstormed the idea and I've written up a rough project summary
> below.  It still needs some work to make this a solid internship
> project idea.
>
> Any thoughts?  Would you like to co-mentor this summer?
>
> === I2C Passthrough ===
>
> '''Summary:''' Implement I2C bus passthrough on Linux hosts so that
> emulated Raspberry Pi or micro:bit boards can talk to real I2C
> devices.

How about implementing USB for raspi boards instead? Or is there a project 
proposal (or even some code somewhere out of tree) for that already? Seems 
more useful to allow having emulated keyboard and mouse to use Raspbian 
for example or pass through USB devices. (I don't know anything about this 
was just reminded to a recent discussion by this message. If it's not 
relevant just disregard my comment and sorry for the noise.)

Regards,
BALATON Zoltan

> QEMU emulates I2C devices in software but currently cannot pass
> through real I2C devices from the host to the guest.  It would be
> useful to access real I2C devices from inside the guest, for example
> for developers writing and testing software under QEMU on their
> computer.
>
> The project consists of the following tasks:
> * Implement -object i2c-bus-passthrough,adapter=N,id=my-i2c-bus
> * Add i2c-bus-passthrough support to at least 1 existing emulated I2C controller
> * Implement micro:bit TWI controller emulation on the nRF51 system-on-chip
>
> This project will allow you to learn about the I2C bus and how to
> write device emulation code in QEMU.  You will enjoy it if you like
> working with physical hardware.
>
> '''Links:'''
> * [https://en.wikipedia.org/wiki/I%C2%B2C I2C wikipedia page]
> * [https://elinux.org/Interfacing_with_I2C_Devices Overview of Linux
> I2C programming interfaces]
> * [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/Documentation/i2c/dev-interface
> Linux I2C userspace interface documentation]
>
> '''Details:'''
> * Skill level: intermediate
> * Language: C
> * Mentor: Paolo Bonzini <pbonzini@redhat.com> ("bonzini" on IRC),
> Stefan Hajnoczi <stefanha@redhat.com> ("stefanha" on IRC)
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] Internship idea: I2C passthrough
  2019-01-09 18:23 ` BALATON Zoltan
@ 2019-01-09 21:16   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2019-01-09 21:16 UTC (permalink / raw)
  To: BALATON Zoltan, Stefan Hajnoczi
  Cc: qemu-devel, Jim Mussared, Joel Stanley, Jonathan Austin

On 09/01/19 19:23, BALATON Zoltan wrote:
>> '''Summary:''' Implement I2C bus passthrough on Linux hosts so that
>> emulated Raspberry Pi or micro:bit boards can talk to real I2C
>> devices. 
>
> How about implementing USB for raspi boards instead? Or is there a
> project proposal (or even some code somewhere out of tree) for that
> already? Seems more useful to allow having emulated keyboard and mouse
> to use Raspbian for example or pass through USB devices. (I don't know
> anything about this was just reminded to a recent discussion by this
> message. If it's not relevant just disregard my comment and sorry for
> the noise.)

That's also a valid idea.  However, Stefan has misinterpreted the
reference to the raspi that I quickly made on IRC.  The idea of I2C
passthrough is that a single board computer like a Raspberry Pi can be
used to develop application for a microcontroller such as micro:bit,
without having to flash the firmware again and again, etc.

Real I2C devices---for example a GPIO extender, a temperature sensor or
a real-time clock---would be attached to the I2C bus on the single board
computer's GPIO headers, exposed as an I2C device through /dev/i2c, and
then driven by the emulated micro:bit through its own I2C controller (or
bitbanged).

(I've now updated the project idea).

Paolo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-09 21:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09 17:09 [Qemu-devel] Internship idea: I2C passthrough Stefan Hajnoczi
2019-01-09 18:23 ` BALATON Zoltan
2019-01-09 21:16   ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.