29 Oct, 2018

40 commits

  • export these two interface for cgroup-v1.

    Acked-by: Tejun Heo
    Signed-off-by: weiping zhang
    Signed-off-by: Jens Axboe
    (cherry picked from commit 17534c6f2c065ad8e34ff6f013e5afaa90428512)

    weiping zhang
     
  • The __blk_mq_register_dev(), blk_mq_unregister_dev(),
    elv_register_queue() and elv_unregister_queue() calls need to be
    protected with sysfs_lock but other code in these functions not.
    Hence protect only this code with sysfs_lock. This patch fixes a
    locking inversion issue in blk_unregister_queue() and also in an
    error path of blk_register_queue(): it is not allowed to hold
    sysfs_lock around the kobject_del(&q->kobj) call.

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Bart Van Assche
    Signed-off-by: Jens Axboe
    (cherry picked from commit 2c2086afc2b8b974fac32cb028e73dc27bfae442)

    Bart Van Assche
     
  • Since I can remember DM has forced the block layer to allow the
    allocation and initialization of the request_queue to be distinct
    operations. Reason for this is block/genhd.c:add_disk() has requires
    that the request_queue (and associated bdi) be tied to the gendisk
    before add_disk() is called -- because add_disk() also deals with
    exposing the request_queue via blk_register_queue().

    DM's dynamic creation of arbitrary device types (and associated
    request_queue types) requires the DM device's gendisk be available so
    that DM table loads can establish a master/slave relationship with
    subordinate devices that are referenced by loaded DM tables -- using
    bd_link_disk_holder(). But until these DM tables, and their associated
    subordinate devices, are known DM cannot know what type of request_queue
    it needs -- nor what its queue_limits should be.

    This chicken and egg scenario has created all manner of problems for DM
    and, at times, the block layer.

    Summary of changes:

    - Add device_add_disk_no_queue_reg() and add_disk_no_queue_reg() variant
    that drivers may use to add a disk without also calling
    blk_register_queue(). Driver must call blk_register_queue() once its
    request_queue is fully initialized.

    - Return early from blk_unregister_queue() if QUEUE_FLAG_REGISTERED
    is not set. It won't be set if driver used add_disk_no_queue_reg()
    but driver encounters an error and must del_gendisk() before calling
    blk_register_queue().

    - Export blk_register_queue().

    These changes allow DM to use add_disk_no_queue_reg() to anchor its
    gendisk as the "master" for master/slave relationships DM must establish
    with subordinate devices referenced in DM tables that get loaded. Once
    all "slave" devices for a DM device are known its request_queue can be
    properly initialized and then advertised via sysfs -- important
    improvement being that no request_queue resource initialization
    performed by blk_register_queue() is missed for DM devices anymore.

    Signed-off-by: Mike Snitzer
    Reviewed-by: Ming Lei
    Signed-off-by: Jens Axboe
    (cherry picked from commit fa70d2e2c4a0a54ced98260c6a176cc94c876d27)

    Mike Snitzer
     
  • The original commit e9a823fb34a8b (block: fix warning when I/O elevator
    is changed as request_queue is being removed) is pretty conflated.
    "conflated" because the resource being protected by q->sysfs_lock isn't
    the queue_flags (it is the 'queue' kobj).

    q->sysfs_lock serializes __elevator_change() (via elv_iosched_store)
    from racing with blk_unregister_queue():
    1) By holding q->sysfs_lock first, __elevator_change() can complete
    before a racing blk_unregister_queue().
    2) Conversely, __elevator_change() is testing for QUEUE_FLAG_REGISTERED
    in case elv_iosched_store() loses the race with blk_unregister_queue(),
    it needs a way to know the 'queue' kobj isn't there.

    Expand the scope of blk_unregister_queue()'s q->sysfs_lock use so it is
    held until after the 'queue' kobj is removed.

    To do so blk_mq_unregister_dev() must not also take q->sysfs_lock. So
    rename __blk_mq_unregister_dev() to blk_mq_unregister_dev().

    Also, blk_unregister_queue() should use q->queue_lock to protect against
    any concurrent writes to q->queue_flags -- even though chances are the
    queue is being cleaned up so no concurrent writes are likely.

    Fixes: e9a823fb34a8b ("block: fix warning when I/O elevator is changed as request_queue is being removed")
    Signed-off-by: Mike Snitzer
    Reviewed-by: Ming Lei
    Signed-off-by: Jens Axboe
    (cherry picked from commit 667257e8b2988c0183ba23e2bcd6900e87961606)

    Mike Snitzer
     
  • device_add_disk() will only call bdi_register_owner() if
    !GENHD_FL_HIDDEN, so it follows that del_gendisk() should only call
    bdi_unregister() if !GENHD_FL_HIDDEN.

    Found with code inspection. bdi_unregister() won't do any harm if
    bdi_register_owner() wasn't used but best to avoid the unnecessary
    call to bdi_unregister().

    Fixes: 8ddcd65325 ("block: introduce GENHD_FL_HIDDEN")
    Signed-off-by: Mike Snitzer
    Reviewed-by: Ming Lei
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Jens Axboe
    (cherry picked from commit bc8d062c36e3525e81ea8237ff0ab3264c2317b6)

    Mike Snitzer
     
  • That we we can also poll non blk-mq queues. Mostly needed for
    the NVMe multipath code, but could also be useful elsewhere.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Jens Axboe
    (cherry picked from commit ea435e1b9392a33deceaea2a16ebaa3397bead93)

    Christoph Hellwig
     
  • With this flag a driver can create a gendisk that can be used for I/O
    submission inside the kernel, but which is not registered as user
    facing block device. This will be useful for the NVMe multipath
    implementation.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe
    (cherry picked from commit 8ddcd653257c18a669fcb75ee42c37054908e0d6)

    Christoph Hellwig
     
  • The hidden gendisks introduced in the next patch need to keep the dev
    field in their struct device empty so that udev won't try to create
    block device nodes for them. To support that rewrite disk_devt to
    look at the major and first_minor fields in the gendisk itself instead
    of looking into the struct device.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Johannes Thumshirn
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Jens Axboe
    (cherry picked from commit 517bf3c306bad4fe0da631f90ae2ec40924dee2b)

    Christoph Hellwig
     
  • This helpers allows to bounce steal the uncompleted bios from a request so
    that they can be reissued on another path.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Sagi Grimberg
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Jens Axboe
    (cherry picked from commit ef71de8b15d891b27b8c983a9a8972b11cb4576a)

    Christoph Hellwig
     
  • This helper allows reinserting a bio into a new queue without much
    overhead, but requires all queue limits to be the same for the upper
    and lower queues, and it does not provide any recursion preventions.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Sagi Grimberg
    Reviewed-by: Javier González
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Jens Axboe
    (cherry picked from commit f421e1d9ade4e1b88183e54425cf50e390d16a7f)

    Christoph Hellwig
     
  • Set aside a bit in the request/bio flags for driver use.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Sagi Grimberg
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Johannes Thumshirn
    Signed-off-by: Jens Axboe
    (cherry picked from commit 96222bcc732d0504363dc772637c50e53b4bd41e)

    Christoph Hellwig
     
  • This flag should be before the operation-specific REQ_NOUNMAP bit.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Sagi Grimberg
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Johannes Thumshirn
    Signed-off-by: Jens Axboe
    (cherry picked from commit 8977f563845bdd61fc61c4dfb399270b7d5667c6)

    Christoph Hellwig
     
  • This patch does not change any functionality.

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Bart Van Assche
    Signed-off-by: Jens Axboe
    (cherry picked from commit 14a23498ba97683c6790b1bcd8b2cdfe9ad99797)

    Bart Van Assche
     
  • These two functions are only called from inside the block layer so
    unexport them.

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Bart Van Assche
    Signed-off-by: Jens Axboe
    (cherry picked from commit 83d016ac86428dbca8a62d3e4fdc29e3ea39e535)

    Bart Van Assche
     
  • Fix bug of commit 74d46992e0d9 ("block: replace bi_bdev with a gendisk
    pointer and partitions index").

    bio_dev(bio) is used to find the dev state in function
    __btrfsic_submit_bio. But when dev_state is added to the hashtable, it
    is using dev_t of block_device.

    bio_dev(bio) returns a dev_t of part0 which is different from dev_t in
    block_device(bd_dev). bd_dev in block_device represents the exact
    partition.

    block_device.bd_dev =
    bio->bi_partno (same as block_device.bd_partno) + bio_dev(bio).

    When adding a dev_state into hashtable, we use the exact partition dev_t.
    So when looking it up, it should also use the exact partition dev_t.

    Reproducer of this bug:

    Use MOUNT_OPTIONS="-o check_int" and run btrfs/001 in fstests.
    Then there will be WARNING like below.

    WARNING:
    btrfs: attempt to write superblock which references block M @29523968 (sda7 /1111654400/2) which is never written!

    Signed-off-by: Gu JinXiang
    Reviewed-by: David Sterba
    Signed-off-by: David Sterba
    (cherry picked from commit d28e649a5c58b779b303c252c66ee84a0f2c3b32)

    Gu JinXiang
     
  • Fix a typo in pkt_start_recovery.

    Fixes: 74d46992e0d9 ("block: replace bi_bdev with a gendisk pointer and partitions index")
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jiufei Xue
    Signed-off-by: Jens Axboe
    (cherry picked from commit 158e61865a31ef7abf39629c37285810504d60b5)

    Jiufei Xue
     
  • According to ADD, the audio ahb and ipg clock should be in 1:1 mode
    and the frequency is 400MHz

    Signed-off-by: Shengjiu Wang
    Reviewed-by: Viorel Suman
    (cherry picked from commit ee175a8cea1a7d27954a73c3447bb16edd71f4c8)

    Shengjiu Wang
     
  • add new dts for m4 audio playback

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit 7343c0bd256d7ade1152f83bd0eb395d29e03620)

    Shengjiu Wang
     
  • support codec over rpmsg

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit 0b2238d0b88b19a1134aee54706b64a322c6e51b)

    Shengjiu Wang
     
  • update the rpmsg codec name

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit 6130b919df97b127fafe319f0c2ff601ebc6bed2)

    Shengjiu Wang
     
  • support codec through rpmsg

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit 8585d67e54c4c3607990a792718992de8be8fe58)

    Shengjiu Wang
     
  • support more codecs, codec is specified by compatible string

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit 7c92a75fcf83ec0aa3fe6773e4cb5f5e88a1ff09)

    Shengjiu Wang
     
  • register rpmsg wm8960 and cs42xx8 codec

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit c49f8d20c6fd4479ad45d76290bb5c57d4800d9e)

    Shengjiu Wang
     
  • The difference of rpmsg_cs42xx8 and cs42xx8 driver is previous one
    will send command through rpmsg, others are same.

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit dda40ff395bb1d86fc75920bb2bc2ea99099ed4b)

    Shengjiu Wang
     
  • The difference of rpmsg_wm8960 and wm8960 driver is previous one
    will send command through rpmsg, others are same.

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit 094521755ae806a572fd841455371b23408c36d1)

    Shengjiu Wang
     
  • The format send to M4 through rpmsg is wrong, that make the
    driver treat the data as S32_LE, it looks like data is right
    shift 8 bit.

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit 508550b70e80339d3d49594ffc23946dd80b0c82)

    Shengjiu Wang
     
  • With the 800M clock source, there is noise on SAI5 (PDM, or AK5558)
    recording with some chips, but it may be ok for other chips.
    The reason is not clear.
    This patch is to switch the clock source to 500M.

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit 3f4e34d26ceb8569eeb6cbb2e5a410d0332a9e62)

    Shengjiu Wang
     
  • There is a change in imx8mm evk revb board, which is to add a i2c
    control for power enablement of audio board, that software can
    control the power of audio board, which can resolve the issue that
    with audio board the cpu board can't reboot issue.

    In this patch add power supply for each AK series codecs

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit 1d3d7e6d6ecd0ab62fb9bb568a5afeb2fbeda1ca)

    Shengjiu Wang
     
  • add regulators for ak5558

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit 914f117ffb4233ba630515d8426d30006a82794f)

    Shengjiu Wang
     
  • add regulators for ak4497

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit c33df8b3f4a05ff9a6f12bb66ac9b5f6fcaaaf3e)

    Shengjiu Wang
     
  • add regulator for ak4458

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit 6b9f1e42e6d4f59ad2c66c0d327fc6d63572147f)

    Shengjiu Wang
     
  • support playback and record for rpmsg device

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit b06f0122c6c280eff3bb83b0dfa284ce93526ef3)

    Shengjiu Wang
     
  • only support playback for rpmsg device on imx8mm evk.

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit a6e9ff5efc814fa08f7e4664f584861b4a4d5792)

    Shengjiu Wang
     
  • Some platform the rpmsg device only support playback or record. So
    Add a property to differentiate them.

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit aa8b9304d207e5f00cca8a41772c130dd4c6944b)

    Shengjiu Wang
     
  • enable sound-rpmsg in fsl-imx8mm-evk-m4

    Signed-off-by: Shengjiu Wang
    Reviewed-by: Viorel Suman
    (cherry picked from commit 195a79896f105e5537ae4dfde97e87a9e198cbbd)

    Shengjiu Wang
     
  • enable i2s over rpmsg

    Signed-off-by: Shengjiu Wang
    Reviewed-by: Viorel Suman
    (cherry picked from commit 0ee32296ec540e5c11c627012656f0373317eaac)

    Shengjiu Wang
     
  • In imx8mm, there is no controls for wm8524, so we use the
    dummy codec instead.

    Signed-off-by: Shengjiu Wang
    Reviewed-by: Viorel Suman
    (cherry picked from commit 43bcd3a8e9f4c1b2af9974f2082a34beacfba4a1)

    Shengjiu Wang
     
  • Update the read and write function for the send_message function
    changes

    Signed-off-by: Shengjiu Wang
    Reviewed-by: Viorel Suman
    (cherry picked from commit 4610826f39ee4124588b818e5589c25448aa3dba)

    Shengjiu Wang
     
  • Add ack function, which is to info M4 side how many data
    has been writen to buffer.

    Add timer, which is to get the position of hw pointer in m4.

    Signed-off-by: Shengjiu Wang
    Reviewed-by: Viorel Suman
    (cherry picked from commit 0fd349fbab28d97f8c5501ec635bff053e3b1470)

    Shengjiu Wang
     
  • Add two new message command I2S_TX_POINTER and I2S_RX_POINTER,
    which are used to get the hw pointer in m4 side. For in low
    power audio mode, m4 won't send notification every period, the
    notification only be sent when hw pointer reach end of buffer,
    so we need these command to get the position of hw pointer,
    user can use it to calculate the timestamp.

    Restructure send message and recv message together for i2s_rpmsg,
    that every send message has a recv message. so the
    i2s_send_message can store the recv message indepedently. one
    reason is that the receive message is async withe send message.

    The low power audio is disabled in default, user need to enabled
    it by add "fsl,enable-lpa" in dts.

    Signed-off-by: Shengjiu Wang
    Reviewed-by: Viorel Suman
    (cherry picked from commit 753e7b819609ad4791e32069a124d4411c720947)

    Shengjiu Wang